Hi I'm new to this forum, and this is going to be my first post.
Here's my question: I know you can reference historical data by using "[1]" (1 bar ago), but is it allowed to reference future data using "[-1]" (1 bar ahead)?
I'm asking this question because I'm working on a study that calls for identifying the highest/lowest price within a range of 5 bars, i.e. current bar, 2 bars before current bar, and 2 bars after current bar.
But this is not exactly what I'm looking for. Let me do a better job explaining my idea:
1) I would first look for the highest/lowest point within 3 bars, i.e. current bar and previous 2 bars.
2) Then I would wait for the next 2 bars to confirm. If the next 2 bars do not break through the previous range, then the range holds. If the next 2 bars do break through the previous range, then range would adapt dynamically.
Site Administrator Swing Trader Data Scientist & DevOps
Manta, Ecuador
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
Posts: 49,765 since Jun 2009
Thanks: 32,302 given,
97,542
received
Just about anything is possible. Try the above code, I just wrote it free hand so it may need some work and probably a good amount of refinement for your exact needs, but I think you get the general idea.
FYI, here's what I had in mind (hence my original question):
For high point: MaxList(high[2],high[1],high[0],high[-1],high[-2])
For low point: MinList(low[2],low[1],low[0],low[-1],low[-2])
Trying to access a bar that hasn't happened yet is impossible.
That's why H[-1] doesn't work. It's in the future, so you don't know what it will be (unless you have the Delorean with the flux capacitor as stated above).
Here's a system that would work great because it knows whether to buy or sell short today and at what price, as well as what price to close the trade on tomorrow:
I wish my computer knew what the prices are gonna be for the next day or two, but unfortunately, it doesn't.
"I wish my computer knew what the prices are gonna be for the next day or two, but unfortunately, it doesn't."
Sorry for re-activating an old post but am new to MC and thought that you may not be aware that you can call up future bars/prices in Easylanguage. It is a dll called AnyOHLC.dll. However one needs to be very careful in applying it in signals!
The following user says Thank You to sunbeam for this post: