How to write in MQL code referring to the open/close value of the 2nd and 3rd candle before current candle?
I just asked this question and I believe it is Open[PERIOD], for example Open[1] would be the open price of the candle that just closed. Open[2] would be the candle before that.
Can someone confirm?
P&G
Yes, its this method for the last closed bar
Open[1]
High[1]
Low[1]
Close[1]
and these for the bar before, etc
Open[2]
High[2]
Low[2]
Close[2]
Good luck
-BB-
Thank you.
Cheers,
Good people you are!
Is there a way to get the median price for the last bar? Something like Median[1]? I can't find any documentation for that. Does it exist?
golden188:
Is there a way to get the median price for the last bar? Something like Median[1]? I can't find any documentation for that. Does it exist?
Is there a way to get the median price for the last bar? Something like Median[1]? I can't find any documentation for that. Does it exist?
Median[1]=High[1]-Low[1], if that is not what you are looking for, then you would have to figure out a formule and use close,open,high, and low values to get your median value.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
[For example]
Last three candles has the following values:
_________________________________________
[3 candle]
Open 1.1234
Close 1.1249
[2 candle]
Open 1.1249
Close 1.1280
[3 candle - current candle]
Ask: 1.1285
Bid: 1.1284
____________________________________________________________________________________
My question is: How to write the code in MQL referring to the opening / closing the last two candles?
____________________________________________________________________________________