Need help with candle comparison code

 

Hello, can anyone help me with a code sample.. I'd like to get a closing price comparision between two candles (two time points) from historical data. The code then repeats this every x(50) candles to now (present candle) and compares the closing price to the previous loop.

Logic:

comparison of closing price between candle1.close[time1] and candle50.close[time50] (returns..does something with it)

the comparison then loops every 50 candles until it reaches the current candle time (for every loop the returned value is then compared to the previous one and returns something)

between Candle1.close[time1+50candles] and [time50+50candles]

Thank you!

 
please look on iBarShift
 
d3subz:

Hello, can anyone help me with a code sample.. I'd like to get a closing price comparision between two candles (two time points) from historical data. The code then repeats this every x(50) candles to now (present candle) and compares the closing price to the previous loop.

Logic:

comparison of closing price between candle1.close[time1] and candle50.close[time50] (returns..does something with it)

the comparison then loops every 50 candles until it reaches the current candle time (for every loop the returned value is then compared to the previous one and returns something)

between Candle1.close[time1+50candles] and [time50+50candles]

Thank you!

the two comparison would need to be store in some form.  Are you writing an average of the difference or just an array with 50 values?