About property strict

 

For EA, when i should use property strict and when i should not use it?

PS: What is recommended by a programmer?

 
Qæs:

For EA, when i should use property strict and when i should not use it?

PS: What is recommended by a programmer?

You should use it every time

 
Always use strict. Fixing the warnings will save you hours of debugging.
          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.

 
Qæs:

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
 
whroeder1:
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;

  1. 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

  1. 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".
Can any of the above two options be a temporary solution?
Reason: