Specification
Description:
Custom indicator to project future path of MA and path of price either side of MA using average change in MA and average height of price above or below MA from previous crosses of price over MA.
Settings:
Candles to sample
Ma settings
Projected ma line colour
Projected price line colour
Turning point colour
Turning point range e.g 10th percentile to 90th percentile.
Data collections:
Upside range:
According to how many candles to sample, record the largest number of consecutive candle closes above MA. Take this number + 1. This is the upside range top
Downside range:
According to how many candles to sample, record the largest number of consecutive candle closes below MA. Take this number + 1. This is the downside range top
Average price:
Upside and downside sets are separate sets of data recording the difference in price above or below the MA.
All data recorded for each candle in each set is ordered from smallest to largest.
Upside Set - Price
Candle opens below MA and closes above MA. This is candle 1 and its height above MA is recorded.
Next candle closes above MA. This is candle 2 and it's height above MA is recorded. This repeats candle 3,4,5 etc.
Candle opens above MA and closes below MA. This is the last candle in the upside set and is recorded as 0 above MA in the upside set. It is also the start of the downside set.
If this upside set does not reach the same number of entries as the upside range top, all remaining candles from the last candle of this set to the upside range top are recorded as zero.
Downside Set - Price
Candle opens above MA and closes below MA. This is candle 1 and its height below MA is recorded.
Next candle closes below MA. This is candle 2 and it's height below MA is recorded. This repeats candle 3,4,5 etc.
Candle opens below MA and closes above MA. This is the last candle in the downside set and is recorded as 0 below MA in the downside set. It is also the start of the upside set.
If this downside set does not reach the same number of entries as the downside range top, all remaining candles from the last candle of this set to the downside range top are recorded as zero.
Average MA:
MA Upside and MA downside sets are separate sets of data recording the change in price of the MA from the point where price crosses it.
All data recorded for each candle in each set is ordered from smallest to largest.
Upside Set - MA
Candle opens below MA and closes above MA. This is the starting point in the MA upside set.
Next candle closes above MA. This is point 2 and the change in price from the starting point of the MA to its current price is recorded. This repeats candle 3,4,5 etc.
Candle opens above MA and closes below MA. This is the last candle in the MA upside set and the change in price from the starting point to current price of the MA is recorded. It is also the start of the MA downside set.
Upside Set - MA
Candle opens below MA and closes above MA. This is the starting point in the MA upside set.
Next candle closes above MA. This is point 2 and the change in price from the starting point of the MA to its current price is recorded. This repeats candle 3,4,5 etc.
Candle opens above MA and closes below MA. This is the last candle in the MA upside set and the change in price from the starting point to current price of the MA is recorded. It is also the start of the MA downside set.
If this downside set does not reach the same number of entries as the downside range top, all remaining candles from the last candle of this set to the downside range top are recorded as zero.
Indicator:
Upside MA:
Candle closes above MA
Compare the change in price of the the MA from this point to the previous point. If current point is starting point, then wait until next.
Compare change in price of MA for current candle number to corresponding previous candle's change in MA data. Find what percentile the current candle falls into in comparison to previous data for this number candle.
Average this new percentile score with previous percentile scores for this upside MA. If this is the first score then no need to average.
Take final averaged score and select the result with the same score for each future candle until the last candle recorded has a 0.
Finally plot each of these selected points ahead of the current candle. Draw a line between each point to create curve.
Upside price:
Candle closes above MA.
Take price from MA to current candle close and compare with corresponding candle's data. Find what percentile it falls into in comparison to previous data for this number candle.
Average this new percentile score with previous percentile scores for this upside price. If this is the first score then no need to average.
Take final averaged score and select the result with the same score for each future candle until the last candle recorded has a 0.
Finally, plot each of these selected points ahead of the current candle. The number describes the height above the MA and is where it should be plotted. It should be calculated from the projected MA.
Carry out same steps for both downside
Turning point:
Mark where the projected price curve changes from positive/negative incline to the opposite.
Draw line starting with 10th percentile turning point and through each percentile to 90th percentile turning point.
Display:
Show which MA percentile currently displayed
Show which price percentile currently displayed.