What you describe here is provided in many of the built in studies in Thinkorswim. The input is often named “displacement”. It enables you to “shift” various plots left or right. The Ichimoku indicator applies this technique to “Span A” and “Span B”. Take a close look at that code to get a better understanding of its application.
In your case you have defined an 9 period ema:
def ema9 = ExpAverage(close, 9);
If we want to shift this 5 candles to the right we use [-5] at the end of the variable. So to plot this 9 period ema 5 candles to the right:
plot shiftedEMA9 = ema9[-5];
Positive values in the brackets will shift left, negative values will shift right.
It is very important to note that this does not turn a “lagging” plot into a “predicting” plot. You could achieve a very similar result by simply reducing the length of the ema. That said, the Ichimoku cloud, being shifted many candles into the future, does seem to provide some predictive value.
Yes, I understand that by displacing the indicator it doesn’t make it a predicting indicator, I was just trying to get my point across. ? Thank you… I knew I had to use the ”displacement” input I just didn’t know where to put the ”displacement” thank you!