I am trying to run an indicator with custom DataSeries, where I want to pass current bars' every tick as value.
For example, this is how EMA can be calculated: EmaValue = EMA(Close, 3)[0]; This logic will use Close price of every bar in calculation over last 3 bars. I want to check what would be EMA value for every tick on my current bar. So I defined custom DataSeries, where I populate previous bars (positions 1 and 2) with Close[1] and Close[2]. Then I do a "for" loop to populate 0 position in custom DataSeries with every tick of the current bar.
Let's say the current bar's High was 1950 and Low was 1940 (for ES emini).
My custom DataSeries would look as follows on the 1st run of the loop:
1950 (current bar High) - index 0
1945.50 (previous bar close) - index 1
1935.50(bar before previous bar close) - index 2
It would look as follows on the 2nd run of the loop:
1949.75 (current bar High minus 1 tick) - index 0
1945.50 (previous bar close) - index 1
1935.50(bar before previous bar close) - index 2
And so on, until every tick of the current bar is passed in index position 0. As you can see, only index position 0 changes in custom data series. I would assume that EMA value would be a bit different each time it calculates, since first value (index 0) in custom dataseries changes for each calculation.
But, EMA value stays exactly the same for every calculation. Any idea why?
Thanks,
redduke
Comment