I am trying to create a simple moving average where the lines don't extend throughout all the past candlesticks.
I would like to amend the Ninjatrader built-in SMA script to add a user input for how many bars to display the moving average line - that would be the only change.
For example, I'd like a 5 period SMA but I want to be able to set how many bars the actual moving average line appears on in addition to the current bar that the market is trading on - so for example, if I set the input to 10 that means that it would be a 5 period SMA and the actual line would show on the most recent 10 bars, then after that the moving average line would be gone.
I am not sure how to add this functionality to the Ninjatrader built-in SMA indicator, any help is greatly appreciated.

Comment