This Same Candle Run Analysis Tool can be used to analyse runs of the same colour candle in any market and on any time frame. Runs of up to 12 candles of the same colour are analysed.
It calculates a simulated result as if you placed a long trade at the close of a run of the same coloured candles and then closed it one candle later. This can give us an idea what has the highest probability of happening next based on historical data. Although it can be used on any time frame shorter time frames will be slow to calculate and the results fairly meaningless due to the amount of market noise. I would advise using it on anything from yearly to 4 hour time frames.
If you run it on multiple time frames then you can have a fairly good analysis of what is most likely to happen next. For example maybe there has been five years up in a row and the results tells us that the market is more likely to have a down year after five up years. The quarterly results might be five up in a row and the results tell us that the next candle is more likely to be a down quarter. The monthly results show that we have had one down month so it is more likely that the next is an up month but the weekly is showing three weeks down in a row and there is a 60% chance next week will be a down week. So we might look at the overall picture and decide to avoid long trades right now on that market.
The setting ‘CountAll’ can be turned on and off. If ON then the results are calculated using every occurrence of a run. For example a run of three up candles is in fact three runs of one up candle, two runs of two up candles and one run of three up candles and all will be calculated in the results. If set to OFF then just the first occurrence is used – so a run of three up candles for example must be a down candle followed by three up candles.
A spread amount can also be input and is deducted from the results of each trade. Set to zero if you do not want to analyse with spread.
The results returned are:
Wins – the number of trades that would have resulted in profit.
Bets – the total number of bets placed.
% – the percentage of wins to trades.
Total – the balance of all position outcomes.
AveReturn – the average return of all trades.
If you want to know what would have happened if you had gone short then obviously short trades would have resulted in the direct opposite results. So a 60% win rate for long trades would be a 40% win rate if you had gone short and a return of +1255 for long trades would be a loss of 1255 for short trades.
I advise making the indicator window full size and zooming in to the last candles to make the results more readable. Sorry if the columns do not line up very well but this is due to the limitations of text in PRT indicators.
I also have a version Same Candle Run Analysis Graph that returns the Total in graph format and I recommend using it alongside this tool as it allows you to easily see which results have been consistent over time.
I advise you to download the .ITF file and import it rather than cut and paste the code to ensure that you get full functionality.
//Same Candle Run Analysis Tool
//Created by Vonasi
//07-04-2018
IF CountAll = 1 THEN
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] < open[10] and close[11] < open[11] and close[12] < open[12] THEN
Down12 = Down12 + 1
DownCount12 = DownCount12 + 1
Down12Total = Down12Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] < open[10] and close[11] < open[11] and close[12] < open[12] THEN
DownCount12 = DownCount12 + 1
Down12Total = Down12Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] < open[10] and close[11] < open[11] THEN
Down11 = Down11 + 1
DownCount11 = DownCount11 + 1
Down11Total = Down11Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] < open[10] and close[11] < open[11] THEN
DownCount11 = DownCount11 + 1
Down11Total = Down11Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] < open[10] THEN
Down10 = Down10 + 1
DownCount10 = DownCount10 + 1
Down10Total = Down10Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] < open[10] THEN
DownCount10 = DownCount10 + 1
Down10Total = Down10Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] THEN
Down9 = Down9 + 1
DownCount9 = DownCount9 + 1
Down9Total = Down9Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9]THEN
DownCount9 = DownCount9 + 1
Down9Total = Down9Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] THEN
Down8 = Down8 + 1
DownCount8 = DownCount8 + 1
Down8Total = Down8Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] THEN
DownCount8 = DownCount8 + 1
Down8Total = Down8Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] THEN
Down7 = Down7 + 1
DownCount7 = DownCount7 + 1
Down7Total = Down7Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] THEN
DownCount7 = DownCount7 + 1
Down7Total = Down7Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] THEN
Down6 = Down6 + 1
DownCount6 = DownCount6 + 1
Down6Total = Down6Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] THEN
DownCount6 = DownCount6 + 1
Down6Total = Down6Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] THEN
Down5 = Down5 + 1
DownCount5 = DownCount5 + 1
Down5Total = Down5Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] THEN
DownCount5 = DownCount5 + 1
Down5Total = Down5Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] THEN
Down4 = Down4 + 1
DownCount4 = DownCount4 + 1
Down4Total = Down4Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] THEN
DownCount4 = DownCount4 + 1
Down4Total = Down4Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] THEN
Down3 = Down3 + 1
DownCount3 = DownCount3 + 1
Down3Total = Down3Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] THEN
DownCount3 = DownCount3 + 1
Down3Total = Down3Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] THEN
Down2 = Down2 + 1
DownCount2 = DownCount2 + 1
Down2Total = Down2Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] THEN
DownCount2 = DownCount2 + 1
Down2Total = Down2Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] THEN
Down1 = Down1 + 1
DownCount1 = DownCount1 + 1
Down1Total = Down1Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] THEN
DownCount1 = DownCount1 + 1
Down1Total = Down1Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] > open[10] and close[11] > open[11] and close[12] > open[12] THEN
Up12 = Up12 + 1
UpCount12 = UpCount12 + 1
Up12Total = Up12Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] > open[10] and close[11] > open[11] and close[12] > open[12] THEN
UpCount12 = UpCount12 + 1
Up12Total = Up12Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] > open[10] and close[11] > open[11] THEN
Up11 = Up11 + 1
UpCount11 = UpCount11 + 1
Up11Total = Up11Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] > open[10] and close[11] > open[11] THEN
UpCount11 = UpCount11 + 1
Up11Total = Up11Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] > open[10] THEN
Up10 = Up10 + 1
UpCount10 = UpCount10 + 1
Up10Total = Up10Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] > open[10] THEN
UpCount10 = UpCount10 + 1
Up10Total = Up10Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] THEN
Up9 = Up9 + 1
UpCount9 = UpCount9 + 1
Up9Total = Up9Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] THEN
UpCount9 = UpCount9 + 1
Up9Total = Up9Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] THEN
Up8 = Up8 + 1
UpCount8 = UpCount8 + 1
Up8Total = Up8Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] THEN
UpCount8 = UpCount8 + 1
Up8Total = Up8Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] THEN
Up7 = Up7 + 1
UpCount7 = UpCount7 + 1
Up7Total = Up7Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] THEN
UpCount7 = UpCount7 + 1
Up7Total = Up7Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] THEN
Up6 = Up6 + 1
UpCount6 = UpCount6 + 1
Up6Total = Up6Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] THEN
UpCount6 = UpCount6 + 1
Up6Total = Up6Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] THEN
Up5 = Up5 + 1
UpCount5 = UpCount5 + 1
Up5Total = Up5Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] THEN
UpCount5 = UpCount5 + 1
Up5Total = Up5Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] THEN
Up4 = Up4 + 1
UpCount4 = UpCount4 + 1
Up4Total = Up4Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] THEN
UpCount4 = UpCount4 + 1
Up4Total = Up4Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] THEN
Up3 = Up3 + 1
UpCount3 = UpCount3 + 1
Up3Total = Up3Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] THEN
UpCount3 = UpCount3 + 1
Up3Total = Up3Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] THEN
Up2 = Up2 + 1
UpCount2 = UpCount2 + 1
Up2Total = Up2Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] THEN
UpCount2 = UpCount2 + 1
Up2Total = Up2Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] THEN
Up1 = Up1 + 1
UpCount1 = UpCount1 + 1
Up1Total = Up1Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] THEN
UpCount1 = UpCount1 + 1
Up1Total = Up1Total + (close - open) - Spread
ENDIF
ENDIF
IF CountAll <> 1 THEN
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] < open[10] and close[11] < open[11] and close[12] < open[12] and close[13] > open[13] THEN
Down12 = Down12 + 1
DownCount12 = DownCount12 + 1
Down12Total = Down12Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] < open[10] and close[11] < open[11] and close[12] < open[12] and close[13] > open[13] THEN
DownCount12 = DownCount12 + 1
Down12Total = Down12Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] < open[10] and close[11] < open[11] and close[12] > open[12] THEN
Down11 = Down11 + 1
DownCount11 = DownCount11 + 1
Down11Total = Down11Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] < open[10] and close[11] < open[11] and close[12] > open[12] THEN
DownCount11 = DownCount11 + 1
Down11Total = Down11Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] < open[10] and close[11] > open[11] THEN
Down10 = Down10 + 1
DownCount10 = DownCount10 + 1
Down10Total = Down10Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] < open[10] and close[11] > open[11] THEN
DownCount10 = DownCount10 + 1
Down10Total = Down10Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] > open[10] THEN
Down9 = Down9 + 1
DownCount9 = DownCount9 + 1
Down9Total = Down9Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] < open[9] and close[10] > open[10] THEN
DownCount9 = DownCount9 + 1
Down9Total = Down9Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] > open[9] THEN
Down8 = Down8 + 1
DownCount8 = DownCount8 + 1
Down8Total = Down8Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] < open[8] and close[9] > open[9] THEN
DownCount8 = DownCount8 + 1
Down8Total = Down8Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] > open[8] THEN
Down7 = Down7 + 1
DownCount7 = DownCount7 + 1
Down7Total = Down7Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] < open[7] and close[8] > open[8] THEN
DownCount7 = DownCount7 + 1
Down7Total = Down7Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] > open[7] THEN
Down6 = Down6 + 1
DownCount6 = DownCount6 + 1
Down6Total = Down6Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] < open[6] and close[7] > open[7] THEN
DownCount6 = DownCount6 + 1
Down6Total = Down6Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] > open[6] THEN
Down5 = Down5 + 1
DownCount5 = DownCount5 + 1
Down5Total = Down5Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] < open[5] and close[6] > open[6] THEN
DownCount5 = DownCount5 + 1
Down5Total = Down5Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] > open[5] THEN
Down4 = Down4 + 1
DownCount4 = DownCount4 + 1
Down4Total = Down4Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and close[5] > open[5] THEN
DownCount4 = DownCount4 + 1
Down4Total = Down4Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] > open[4] THEN
Down3 = Down3 + 1
DownCount3 = DownCount3 + 1
Down3Total = Down3Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] > open[4] THEN
DownCount3 = DownCount3 + 1
Down3Total = Down3Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] < open[2] and close[3] > open[3] THEN
Down2 = Down2 + 1
DownCount2 = DownCount2 + 1
Down2Total = Down2Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] < open[2] and close[3] > open[3] THEN
DownCount2 = DownCount2 + 1
Down2Total = Down2Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] < open[1] and close[2] > open[2] THEN
Down1 = Down1 + 1
DownCount1 = DownCount1 + 1
Down1Total = Down1Total + (close - open) - Spread
ENDIF
IF close < open and close[1] < open[1] and close[2] > open[2] THEN
DownCount1 = DownCount1 + 1
Down1Total = Down1Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] > open[10] and close[11] > open[11] and close[12] > open[12] and close[13] < open[13] THEN
Up12 = Up12 + 1
UpCount12 = UpCount12 + 1
Up12Total = Up12Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] > open[10] and close[11] > open[11] and close[12] > open[12] and close[13] < open[13] THEN
UpCount12 = UpCount12 + 1
Up12Total = Up12Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] > open[10] and close[11] > open[11] and close[12] < open[12] THEN
Up11 = Up11 + 1
UpCount11 = UpCount11 + 1
Up11Total = Up11Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] > open[10] and close[11] > open[11] and close[12] < open[12] THEN
UpCount11 = UpCount11 + 1
Up11Total = Up11Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] > open[10] and close[11] < open[11] THEN
Up10 = Up10 + 1
UpCount10 = UpCount10 + 1
Up10Total = Up10Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] > open[10] and close[11] < open[11] THEN
UpCount10 = UpCount10 + 1
Up10Total = Up10Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] < open[10] THEN
Up9 = Up9 + 1
UpCount9 = UpCount9 + 1
Up9Total = Up9Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] > open[9] and close[10] < open[10] THEN
UpCount9 = UpCount9 + 1
Up9Total = Up9Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] < open[9] THEN
Up8 = Up8 + 1
UpCount8 = UpCount8 + 1
Up8Total = Up8Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] > open[8] and close[9] < open[9] THEN
UpCount8 = UpCount8 + 1
Up8Total = Up8Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] < open[8] THEN
Up7 = Up7 + 1
UpCount7 = UpCount7 + 1
Up7Total = Up7Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] > open[7] and close[8] < open[8] THEN
UpCount7 = UpCount7 + 1
Up7Total = Up7Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] < open[7] THEN
Up6 = Up6 + 1
UpCount6 = UpCount6 + 1
Up6Total = Up6Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] > open[6] and close[7] < open[7] THEN
UpCount6 = UpCount6 + 1
Up6Total = Up6Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] < open[6] THEN
Up5 = Up5 + 1
UpCount5 = UpCount5 + 1
Up5Total = Up5Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] > open[5] and close[6] < open[6] THEN
UpCount5 = UpCount5 + 1
Up5Total = Up5Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] < open[5] THEN
Up4 = Up4 + 1
UpCount4 = UpCount4 + 1
Up4Total = Up4Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and close[5] < open[5] THEN
UpCount4 = UpCount4 + 1
Up4Total = Up4Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] < open[4] THEN
Up3 = Up3 + 1
UpCount3 = UpCount3 + 1
Up3Total = Up3Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] < open[4] THEN
UpCount3 = UpCount3 + 1
Up3Total = Up3Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] > open[2] and close[3] < open[3] THEN
Up2 = Up2 + 1
UpCount2 = UpCount2 + 1
Up2Total = Up2Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] > open[2] and close[3] < open[3]THEN
UpCount2 = UpCount2 + 1
Up2Total = Up2Total + (close - open) - Spread
ENDIF
IF close > Open + Spread and close[1] > open[1] and close[2] < open[2] THEN
Up1 = Up1 + 1
UpCount1 = UpCount1 + 1
Up1Total = Up1Total + (close - open) - Spread
ENDIF
IF close < open and close[1] > open[1] and close[2] < open[2] THEN
UpCount1 = UpCount1 + 1
Up1Total = Up1Total + (close - open) - Spread
ENDIF
ENDIF
DownPerc12 = Round((Down12/DownCount12)*1000)/10
DownPerc11 = Round((Down11/DownCount11)*1000)/10
DownPerc10 = Round((Down10/DownCount10)*1000)/10
DownPerc9 = Round((Down9/DownCount9)*1000)/10
DownPerc8 = Round((Down8/DownCount8)*1000)/10
DownPerc7 = Round((Down7/DownCount7)*1000)/10
DownPerc6 = Round((Down6/DownCount6)*1000)/10
DownPerc5 = Round((Down5/DownCount5)*1000)/10
DownPerc4 = Round((Down4/DownCount4)*1000)/10
DownPerc3 = Round((Down3/DownCount3)*1000)/10
DownPerc2 = Round((Down2/DownCount2)*1000)/10
DownPerc1 = Round((Down1/DownCount1)*1000)/10
UpPerc12 = Round((Up12/UpCount12)*1000)/10
UpPerc11 = Round((Up11/UpCount11)*1000)/10
UpPerc10 = Round((Up10/UpCount10)*1000)/10
UpPerc9 = Round((Up9/UpCount9)*1000)/10
UpPerc8 = Round((Up8/UpCount8)*1000)/10
UpPerc7 = Round((Up7/UpCount7)*1000)/10
UpPerc6 = Round((Up6/UpCount6)*1000)/10
UpPerc5 = Round((Up5/UpCount5)*1000)/10
UpPerc4 = Round((Up4/UpCount4)*1000)/10
UpPerc3 = Round((Up3/UpCount3)*1000)/10
UpPerc2 = Round((Up2/UpCount2)*1000)/10
UpPerc1 = Round((Up1/UpCount1)*1000)/10
Down12AveRet = (Round((Down12Total / DownCount12)*100))/100
Down11AveRet = (Round((Down11Total / DownCount11)*100))/100
Down10AveRet = (Round((Down10Total / DownCount10)*100))/100
Down9AveRet = (Round((Down9Total / DownCount9)*100))/100
Down8AveRet = (Round((Down8Total / DownCount8)*100))/100
Down7AveRet = (Round((Down7Total / DownCount7)*100))/100
Down6AveRet = (Round((Down6Total / DownCount6)*100))/100
Down5AveRet = (Round((Down5Total / DownCount5)*100))/100
Down4AveRet = (Round((Down4Total / DownCount4)*100))/100
Down3AveRet = (Round((Down3Total / DownCount3)*100))/100
Down2AveRet = (Round((Down2Total / DownCount2)*100))/100
Down1AveRet = (Round((Down1Total / DownCount1)*100))/100
Up12AveRet = (Round((Up12Total / UpCount12)*100))/100
Up11AveRet = (Round((Up11Total / UpCount11)*100))/100
Up10AveRet = (Round((Up10Total / UpCount10)*100))/100
Up9AveRet = (Round((Up9Total / UpCount9)*100))/100
Up8AveRet = (Round((Up8Total / UpCount8)*100))/100
Up7AveRet = (Round((Up7Total / UpCount7)*100))/100
Up6AveRet = (Round((Up6Total / UpCount6)*100))/100
Up5AveRet = (Round((Up5Total / UpCount5)*100))/100
Up4AveRet = (Round((Up4Total / UpCount4)*100))/100
Up3AveRet = (Round((Up3Total / UpCount3)*100))/100
Up2AveRet = (Round((Up2Total / UpCount2)*100))/100
Up1AveRet = (Round((Up1Total / UpCount1)*100))/100
IF Down1AveRet > 0 THEN
Down1R = 0
Down1G = 128
ELSE
Down1R = 128
Down1G = 0
ENDIF
IF Down2AveRet > 0 THEN
Down2R = 0
Down2G = 128
ELSE
Down2R = 128
Down2G = 0
ENDIF
IF Down3AveRet > 0 THEN
Down3R = 0
Down3G = 128
ELSE
Down3R = 128
Down3G = 0
ENDIF
IF Down4AveRet > 0 THEN
Down4R = 0
Down4G = 128
ELSE
Down4R = 128
Down4G = 0
ENDIF
IF Down5AveRet > 0 THEN
Down5R = 0
Down5G = 128
ELSE
Down5R = 128
Down5G = 0
ENDIF
IF Down6AveRet > 0 THEN
Down6R = 0
Down6G = 128
ELSE
Down6R = 128
Down6G = 0
ENDIF
IF Down7AveRet > 0 THEN
Down7R = 0
Down7G = 128
ELSE
Down7R = 128
Down7G = 0
ENDIF
IF Down8AveRet > 0 THEN
Down8R = 0
Down8G = 128
ELSE
Down8R = 128
Down8G = 0
ENDIF
IF Down9AveRet > 0 THEN
Down9R = 0
Down9G = 128
ELSE
Down9R = 128
Down9G = 0
ENDIF
IF Down10AveRet > 0 THEN
Down10R = 0
Down10G = 128
ELSE
Down10R = 128
Down10G = 0
ENDIF
IF Down11AveRet > 0 THEN
Down11R = 0
Down11G = 128
ELSE
Down11R = 128
Down11G = 0
ENDIF
IF Down12AveRet > 0 THEN
Down12R = 0
Down12G = 128
ELSE
Down12R = 128
Down12G = 0
ENDIF
IF Up1AveRet > 0 THEN
Up1R = 0
Up1G = 128
ELSE
Up1R = 128
Up1G = 0
ENDIF
IF Up2AveRet > 0 THEN
Up2R = 0
Up2G = 128
ELSE
Up2R = 128
Up2G = 0
ENDIF
IF Up3AveRet > 0 THEN
Up3R = 0
Up3G = 128
ELSE
Up3R = 128
Up3G = 0
ENDIF
IF Up4AveRet > 0 THEN
Up4R = 0
Up4G = 128
ELSE
Up4R = 128
Up4G = 0
ENDIF
IF Up5AveRet > 0 THEN
Up5R = 0
Up5G = 128
ELSE
Up5R = 128
Up5G = 0
ENDIF
IF Up6AveRet > 0 THEN
Up6R = 0
Up6G = 128
ELSE
Up6R = 128
Up6G = 0
ENDIF
IF Up7AveRet > 0 THEN
Up7R = 0
Up7G = 128
ELSE
Up7R = 128
Up7G = 0
ENDIF
IF Up8AveRet > 0 THEN
Up8R = 0
Up8G = 128
ELSE
Up8R = 128
Up8G = 0
ENDIF
IF Up9AveRet > 0 THEN
Up9R = 0
Up9G = 128
ELSE
Up9R = 128
Up9G = 0
ENDIF
IF Up10AveRet > 0 THEN
Up10R = 0
Up10G = 128
ELSE
Up10R = 128
Up10G = 0
ENDIF
IF Up11AveRet > 0 THEN
Up11R = 0
Up11G = 128
ELSE
Up11R = 128
Up11G = 0
ENDIF
IF Up12AveRet > 0 THEN
Up12R = 0
Up12G = 128
ELSE
Up12R = 128
Up12G = 0
ENDIF
IF CountAll = 1 THEN
DrawText(" LONG - Count All ON",barindex,14,SansSerif,Standard,10)coloured(0,0,255)
ELSE
DrawText(" LONG - Count All OFF",barindex,14,SansSerif,Standard,10)coloured(0,0,255)
ENDIF
DrawText(" Wins Bets % Total AveReturn",barindex,10,SansSerif,Standard,10)coloured(0,0,255)
DrawText("12 Up #Up12# #UpCount12# #UpPerc12# #Up12Total# #Up12AveRet#",barindex,6,SansSerif,Standard,10)coloured(Up12R,Up12G,0)
DrawText("11 Up #Up11# #UpCount11# #UpPerc11# #Up11Total# #Up11AveRet#",barindex,4,SansSerif,Standard,10)coloured(Up11R,Up11G,0)
DrawText("10 Up #Up10# #UpCount10# #UpPerc10# #Up10Total# #Up10AveRet#",barindex,2,SansSerif,Standard,10)coloured(Up10R,Up10G,0)
DrawText("9 Up #Up9# #UpCount9# #UpPerc9# #Up9Total# #Up9AveRet#",barindex,0,SansSerif,Standard,10)coloured(Up9R,Up9G,0)
DrawText("8 Up #Up8# #UpCount8# #UpPerc8# #Up8Total# #Up8AveRet#",barindex,-2,SansSerif,Standard,10)coloured(Up8R,Up8G,0)
DrawText("7 Up #Up7# #UpCount7# #UpPerc7# #Up7Total# #Up7AveRet#",barindex,-4,SansSerif,Standard,10)coloured(Up7R,Up7G,0)
DrawText("6 Up #Up6# #UpCount6# #UpPerc6# #Up6Total# #Up6AveRet#",barindex,-6,SansSerif,Standard,10)coloured(Up6R,Up6G,0)
DrawText("5 Up #Up5# #UpCount5# #UpPerc5# #Up5Total# #Up5AveRet#",barindex,-8,SansSerif,Standard,10)coloured(Up5R,Up5G,0)
DrawText("4 Up #Up4# #UpCount4# #UpPerc4# #Up4Total# #Up4AveRet#",barindex,-10,SansSerif,Standard,10)coloured(Up4R,Up4G,0)
DrawText("3 Up #Up3# #UpCount3# #UpPerc3# #Up3Total# #Up3AveRet#",barindex,-12,SansSerif,Standard,10)coloured(Up3R,Up3G,0)
DrawText("2 Up #Up2# #UpCount2# #UpPerc2# #Up2Total# #Up2AveRet#",barindex,-14,SansSerif,Standard,10)coloured(Up2R,Up2G,0)
DrawText("1 Up #Up1# #UpCount1# #UpPerc1# #Up1Total# #Up1AveRet#",barindex,-16,SansSerif,Standard,10)coloured(Up1R,Up1G,0)
DrawText("1 Down #Down1# #DownCount1# #DownPerc1# #Down1Total# #Down1AveRet#",barindex,-20,SansSerif,Standard,10)coloured(Down1R,Down1G,0)
DrawText("2 Down #Down2# #DownCount2# #DownPerc2# #Down2Total# #Down2AveRet#",barindex,-22,SansSerif,Standard,10)coloured(Down2R,Down2G,0)
DrawText("3 Down #Down3# #DownCount3# #DownPerc3# #Down3Total# #Down3AveRet#",barindex,-24,SansSerif,Standard,10)coloured(Down3R,Down3G,0)
DrawText("4 Down #Down4# #DownCount4# #DownPerc4# #Down4Total# #Down4AveRet#",barindex,-26,SansSerif,Standard,10)coloured(Down4R,Down4G,0)
DrawText("5 Down #Down5# #DownCount5# #DownPerc5# #Down5Total# #Down5AveRet#",barindex,-28,SansSerif,Standard,10)coloured(Down5R,Down5G,0)
DrawText("6 Down #Down6# #DownCount6# #DownPerc6# #Down6Total# #Down6AveRet#",barindex,-30,SansSerif,Standard,10)coloured(Down6R,Down6G,0)
DrawText("7 Down #Down7# #DownCount7# #DownPerc7# #Down7Total# #Down7AveRet#",barindex,-32,SansSerif,Standard,10)coloured(Down7R,Down7G,0)
DrawText("8 Down #Down8# #DownCount8# #DownPerc8# #Down8Total# #Down8AveRet#",barindex,-34,SansSerif,Standard,10)coloured(Down8R,Down8G,0)
DrawText("9 Down #Down9# #DownCount9# #DownPerc9# #Down9Total# #Down9AveRet#",barindex,-36,SansSerif,Standard,10)coloured(Down9R,Down9G,0)
DrawText("10 Down #Down10# #DownCount10# #DownPerc10# #Down10Total# #Down10AveRet#",barindex,-38,SansSerif,Standard,10)coloured(Down10R,Down10G,0)
DrawText("11 Down #Down11# #DownCount11# #DownPerc11# #Down11Total# #Down11AveRet#",barindex,-40,SansSerif,Standard,10)coloured(Down11R,Down11G,0)
DrawText("12 Down #Down12# #DownCount12# #DownPerc12# #Down12Total# #Down12AveRet#",barindex,-42,SansSerif,Standard,10)coloured(Down12R,Down12G,0)
Hi2 = 16
Hi = 12
Lo = -44
Return Hi,Lo,Hi2