Program Properties (#property) - Preprocessor - Language Basics - MQL4 Reference
Thank you Keith Watford and whroeder1
if i am on M5 chart
Time[0]; // will check time of current char, "bar open time?" of the most recent bar. iTime(NULL,240,0); // will check the time of H4 chart, "bar open time?" of the most recent bar.
am i right?
I want my EA to open trade only if new bar in H4 starts and the trading condition becomes true on H4 chart. i was using Time[0] and my EA was attached on M5 chart. i noticed that it was opening trades according to the time of M5 but not H4. in the manual i found iTime() but its explanation in the manual is confusing me. Please guide.
Thank you Keith Watford and whroeder1
if i am on M5 chart
Time[0]; // will check time of current char, "bar open time?" of the most recent bar. iTime(NULL,240,0); // will check the time of H4 chart, "bar open time?" of the most recent bar.
am i right?
Yes, you are correct.
Bar index 0 will be the current bar.
iTime(NULL,240,0); // will check the time of H4 chart, "bar open time?" of the most recent bar.On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors before accessing prices.
Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors before accessing prices.
Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
For now it is an MTF EA but not for more than one pair, so while understanding Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum if i do one of the following;
- I open two charts, M5 and H4 charts of same pair "XYZ" and i attach EA to M5 of "XYZ". Me and/or the EA checks that THAT other H4 chart of "XYZ" is still opened and not closed.
OR
- I open one chart, M5 of "XYZ" and attach EA to it. The EA checks (if possible) that if another H4 chart of "XYZ" is not opened then (if possible) it opens that another H4 chart of "XYZ".
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
For EA, when i should use property strict and when i should not use it?
PS: What is recommended by a programmer?