i understand the function iClose and iOpen, but i do not understand Close and Open when Programming.
Read the documentation:
Also, check the sections to which above mql elements belong.
- docs.mql4.com
MQL does not provide what you think it should provides. Place the cursor on iClose and press F1.
Beside that look at parameters of the function OnCalculate...
Beside that assume that 99% of your ideas or questions are already worked out here.
So search before trying - it's a lot faster and you won't step into most of the possible error traps.
creating something history wise i understand MQ4 fine. it is just i get confused by how Open and Close compared to iClose and iOpen in what i try to do. i am sure once i get the understanding of it and it clicks with me i understand, but at the moment i am lost. could someone teach me or help me out here, what i miss in logic of understanding Open and Close compared to iClose and iOpen?
Please be aware of where you post. Given that you are are asking about MT4/MQL4, then please post in that section (which is at the end of the forum).
Otherwise, you may end up getting responses about MQL5 coding which may not be relevant and just end up confusing you and making it even worse.
For now, Drazen Penic's post is the most relevant and you should read up on the links provided.
Forum on trading, automated trading systems and testing trading strategies
i understand the function iClose and iOpen, but i do not understand Close and Open when Programming.
Drazen Penic, 2022.09.05 12:45
Read the documentation:
Also, check the sections to which above mql elements belong.
No! "Close[i]" would be equivalent to "iClose( _Symbol, _Period, i)", and "Open[i]" would be equivalent to "iOpen( _Symbol, _Period, i)"
Close[] / Open[] refers only to the current chart symbol and time-frame (on MQL4 only), and iClose() / iOpen() can get values for any symbol or time-frame independently of the chart and it works on both MQL4 and MQL5.No! "Close[i]" would be equivalent to "iClose( _Symbol, _Period, i)", and "Open[i]" would be equivalent to "iOpen( _Symbol, _Period, i)"
Close[] / Open[] refers only to the current chart symbol and time-frame (on MQL4 only), and iClose() / iOpen() can get values for any symbol or time-frame independently of the chart and it works on both MQL4 and MQL5.thank you for the responce, but what code would i need to do then in metatrader 4 to do close price - open price ( for the ask price instead of the bid price ) because history data is only bid price.
what i like to do is use the history ( close ) and compare it to the open ask price, instead of what metatrader does it checking close pride bid with open price bid.
There is no OHLC data for Ask prices. All OHLC bar data on all charts is based on Bid prices. This is for both MT4 and MT5.
On MT4, the only Ask price you have access to is the current Ask price. However, on MT5, you can also access historical tick data, for both Bid and Ask prices, independently of OHLC Bid prices.
So, the answer to your question, is that on MT4, you can't do it (unless you plan to collect the tick data yourself).
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i busy creating an indicator looking back at history bid price in history and the ask price of now.
now the history part i get and works. as shown in the code.
however for the ask price i simply thought i could do remove the i from iClose and iOpen but that did not work.
i understand i could do DoubletoStr(ask,digits) but how would that work in the example at the top? i am a very basic programmer with very few coding skills, but
creating something history wise i understand MQ4 fine. it is just i get confused by how Open and Close compared to iClose and iOpen in what i try to do. i am sure once i get the understanding of it and it clicks with me i understand, but at the moment i am lost. could someone teach me or help me out here, what i miss in logic of understanding Open and Close compared to iClose and iOpen?