Plotting indicators ahead of price


Category:
0
0

This question is very straightforward… How can I shift one of my indicators (we can use a 9 EMA for example) to get plotted 5 spaces to the right, so the indicator won’t be so much of a lagging indicator? All I want to do is take the plot price of a day and shift it 5 spaces to the right. Thank you!

Marked as spam
Posted by (Questions: 34, Answers: 56)
Asked on March 4, 2017 7:53 pm
930 views
0
Private answer

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.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on March 4, 2017 9:02 pm
0

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!

( at March 5, 2017 8:11 am)