I would like to include an indicator in my Strategy so that I can see it in the "Chart" tab when backtesting. However, I wish to make the indicator based on a custom DataSeries.
So what I did was:
1) Declare myDataSeries as DataSeries
1) Put Add(SMA(myDataSeries, 14)) in the Initialize()
2) Put myDataSeries.Set(CurrentBar) in OnBarUpdate()
The output is quite strange to me (please see attachment for printscreen)
1) As CurrentBar is always increasing, there is an unexpected and repeated drop in the indicator
2) The indicator is wrapped by a ADX() for some reason. On the graph it shows SMA(ADX(SPY(Daily),14),14)
Can you please let me know what is wrong with my way of adding a indicator with custom DataSeries? It would also be great if you can tell me if there is a way to plot a indicator directly in the OnBarUpdate() of a strategy.
Thank you.

Comment