I have an indicator that I want to "project" ahead (using the slope of the indicator line over the last N bars). That means plotting to the right of the current (shift=0) bar.
I've been looking everywhere and come up dry.
The only thing I can think of is dropping a line object and keep adjusting it, but then it would always be visible and only make sense when the chart was scrolled all the way to current/right.
Projecting ahead would help in figuring out a bunch of things, e.g., when an MA cross will occur.
I'd appreciate any ideas/suggestions/code, thanks!
I have done 2 indicators which does that.. long time ago.. I can't remember now, by my brain, how I did it..
I will look for them on some backup, and I will post it here as an update for this reply.
For clarification, do you mean something like the image below? The green line?
(I just inserted this green MA, for exemplification, and shifted it by 12).. is something like that [result] what you want to implement on your code?
See Alligator, Ichimoku, and Displaced Moving Average (DMA) Definition and Uses - investopedia Apr 21, 2019
Set the buffer shift to n. Put the value[i] in buffer[i+n]. For positive i, the display will show value[i] in bar i. For i in [-1 … -N] the future values will be to the right.
@rrocchi Yes! Exactly! I would LOVE to get that code from you!!!! EXCEPT I don't want to shift an entire indicator plot line, I want to *extend* the line *unshifted*.
But it would look exactly like that image. You got it.
@William -- Ingenious! Thank you! I don't think I'd ever have thought of that, even though now it seems like the nose on my face. Got it.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.