This isn't so much an "indicator" but rather a different way of analyzing price that I came up with that can be used within custom indicators. Anyone who follows my threads will notice that I tend to prefer to use Typical Price when analyzing price, meaning rather than using the high, low, close, or open of each candle for my averages and other price indicators, I use hlc3 (aka typical price which = (high + low + close) / 3)). I prefer this for two reasons and that's because:
1. I personally believe (and this is strictly an opinion) typical price is overall more important than the high, low, close, or open by themselves. If you've ever used typical price, you'll often notice that candles can cross below or above an average making it seem like "oh, well it broke the average, so it's likely to continue in the direction that it broke the average", but sometimes going by a single price of a candle such as the close, it can give you a false signal where a "fake out" occurs and the price goes right back above or below the average back in the direction it came from. However, if you go by the typical price instead, you'll notice that the candles can sometimes cross above or below an average while the typical price does not cross above or below the average. The typical price essentially serves as a filter of "fake outs" because although the candle may have broken the average, the typical price might not have broken the average, and you'll often notice that a change in trend/overall direction doesn't truly occur until after the typical price has also broken the average. Fake outs can still occur with the typical price, but it's less likely to occur and when it does occur it's usually because the typical price didn't break the average significantly enough and it's a bit easier to identify a fake out for this reason.
2. Typical price smooths out the price data somewhat by not fluctuating nearly as drastically as say the close would, despite situations where volatility is quite high.
All that being said, I've come up with a different way of analyzing the price that's similar to typical price, but instead of going by the high, low, and close of a single candle, it goes by the high, low, and close of the true range, whatever that may be. True range is always the highest range out of the high - the low, the high - the close of one bar ago, or the close of one bar ago - the low. This way, the range essentially includes the price movement that happened overnight/between candles at all times. So if a candle happens to gap up or down, it will include the price movement that occured from the close of the previous candle, whereas if you went by the range of the current candle alone, it wouldn't include the "empty" space where the gap occurred, hence "true" range.
With what I deem as the "Typical True Range Price", rather than using the high, low, and close of the current candle, it will use the high and low of the true range along with the current close. If the high and the low of the true range happens to be the high and the low of the current candle, then it'll use the typical price of the current candle. If the true range happens to be the high of the current candle and the close of the previous candle, then it'll use the high of the current candle, the close of the previous candle, and the close of the current candle. And finally, if the true range happens to be the close of the previous candle and the low of the current candle, then it'll use the close of the previous candle, the low of the current candle, and the close of the current candle.
The line of code is fairly simple:
1. I personally believe (and this is strictly an opinion) typical price is overall more important than the high, low, close, or open by themselves. If you've ever used typical price, you'll often notice that candles can cross below or above an average making it seem like "oh, well it broke the average, so it's likely to continue in the direction that it broke the average", but sometimes going by a single price of a candle such as the close, it can give you a false signal where a "fake out" occurs and the price goes right back above or below the average back in the direction it came from. However, if you go by the typical price instead, you'll notice that the candles can sometimes cross above or below an average while the typical price does not cross above or below the average. The typical price essentially serves as a filter of "fake outs" because although the candle may have broken the average, the typical price might not have broken the average, and you'll often notice that a change in trend/overall direction doesn't truly occur until after the typical price has also broken the average. Fake outs can still occur with the typical price, but it's less likely to occur and when it does occur it's usually because the typical price didn't break the average significantly enough and it's a bit easier to identify a fake out for this reason.
2. Typical price smooths out the price data somewhat by not fluctuating nearly as drastically as say the close would, despite situations where volatility is quite high.
All that being said, I've come up with a different way of analyzing the price that's similar to typical price, but instead of going by the high, low, and close of a single candle, it goes by the high, low, and close of the true range, whatever that may be. True range is always the highest range out of the high - the low, the high - the close of one bar ago, or the close of one bar ago - the low. This way, the range essentially includes the price movement that happened overnight/between candles at all times. So if a candle happens to gap up or down, it will include the price movement that occured from the close of the previous candle, whereas if you went by the range of the current candle alone, it wouldn't include the "empty" space where the gap occurred, hence "true" range.
With what I deem as the "Typical True Range Price", rather than using the high, low, and close of the current candle, it will use the high and low of the true range along with the current close. If the high and the low of the true range happens to be the high and the low of the current candle, then it'll use the typical price of the current candle. If the true range happens to be the high of the current candle and the close of the previous candle, then it'll use the high of the current candle, the close of the previous candle, and the close of the current candle. And finally, if the true range happens to be the close of the previous candle and the low of the current candle, then it'll use the close of the previous candle, the low of the current candle, and the close of the current candle.
The line of code is fairly simple:
Code:
def ttrp = if TrueRange(high, close, low) == high - low then hlc3 else if TrueRange(high, close, low) == high - close[1] then (high + close + close[1]) / 3 else (low + close + close[1]) / 3;