I'm plotting the 20 bar EMA on 2 minute charts on the strategy analyzer, but I notice the same problem in the regular charts so I'm asking here.
One chart (and one backtest) is say for a number of days, and the other chart is for one day only but with all of the settings the same and using exactly the same strategy and strategy inputs.
I'm plotting a stock, so the session begins at 9:30 and since we need 20 bars for the EMA, the strategy is waiting for 20 bars before continuing into the on_bar_update method.
The problem is, that at the beginning of a day, right after the EMAs start plotting on the one day chart, I'm getting different values for the EMAs on the two charts at exactly the same time. So for example at 10:18 on the second day of the 2-minute chart covering multiple days, the 20-bar EMA will be say 155, while the 20-bar EMA on the 2-minute chart covering just that one day is 155.5. This also causes backtesting results to vary. After a while the EMAs on the two charts seem to come together, but I haven't yet printed the EMAs and tried to find out at what point they become the same.
My question is, why would they be different? Once 20 bars have printed for the day, the EMAs should be exactly the same on the two charts. Obviously I can see on the multiday chart that the EMAs are carrying over from the previous day, but that shouldn't cause the EMAs to be different on the new day once 20 bars have printed on the new day? What am I overlooking?
A second, related query is how, on the first day of a chart, can I get my charts to look back to the previous day (even though the previous day doesn't appear on the chart) in order for all the indicators to start printing at say 9:30 when the market opens (instead of waiting for e.g. 20 bars before printing the 20-bar EMA)? I tried Options>Data>Chart Default Lookback Period, but this doesn't seem to have an effect.
Thanks in advance for any thoughts.
Jammy
Comment