just some experimentation to check results, putting it out there. :P
odds of the next bar being up or down bar.
//@version=2 study(title='[RS]Study into sequential probabilitys V0') up_bar = close > open down_bar = close < open up_sequence = max(0, barssince(up_bar == 0) - 1) down_sequence = max(0, barssince(down_bar == 0) - 1) up_bars = cum(up_bar) down_bars = cum(down_bar) up_odds = (up_bars/n)*100 down_odds = (down_bars/n)*100 forecast_up_odds = ((up_bars/n) * pow((up_bars/n), up_sequence))*100 forecast_down_odds = ((down_bars/n) * pow((down_bars/n), down_sequence))*100 plot(forecast_up_odds, color=green) plot(forecast_down_odds, color=maroon)
down_odds = (down_bars/n)*100
are currently not used I think these should be substitued in the line
forecast_up_odds = ((up_bars/n) * pow((up_bars/n), up_sequence))*100
which could then read
forecast_up_odds = (up_odds * pow((up_bars/n), up_sequence))
This is just for clarity it works even without this.