bool AllowTrading=true; if(TimeCurrent() > (MacroEvent - 8 *60) && TimeCurrent() < (MacroEvent + 4 *60) ) AllowTrading=false; else AllowTrading=false;If AllowTrading is false . . . don't trade . .
RaptorUK:
If AllowTrading is false . . . don't trade . .
If AllowTrading is false . . . don't trade . .
Hi Raptor,
Thank you for the answer. Good idea but you have made a little error. The proper syntax should be:
bool AllowTrading=true; if(TimeCurrent() > (MacroEvent - 8 *60) && TimeCurrent() < (MacroEvent + 4 *60) ) AllowTrading=false; else AllowTrading=true;
The next problem is: HOW TO MAKE MacroEvent variable as extern value?
Probably the
datetime MacroEvent = D'2011.11.11 11:11:11';
is not proper initalization of this variable for change MacroEvent value via input parameters window (F7)?
Rgds,
puncher:
The next problem is: HOW TO MAKE MacroEvent variable as extern value?
Did you try it?
The next problem is: HOW TO MAKE MacroEvent variable as extern value?
Probably the
is not proper initalization of this variable for change MacroEvent value via input parameters window (F7)?
no I did not yet
puncher:
Yep, copy and paste error . . . you got the idea though, that was the main thing ;-)
Hi Raptor,
Thank you for the answer. Good idea but you have made a little error. The proper syntax should be:
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
I would like to define datetime type varibale (called MacroEvent) for setting planned macro event in comming week.
For example on Friday 11th November 2011, on 11:11:11 will be publicated very important message for financial markets.
Then I would like to hold up my EA robot 8 minutes before and 4 minutes after publication the MacroEvent. It means that the EA can not open orders between: 2011.11.11 11:03:11 - 2011.11.11 11:15:11 and all the opened orders should be closed in the meantime. Besides, I would like to make this variable as the external variable (editable).
Can anybody give me any example of the expression for MQL4 syntax how to program something like that?
Thanks in advance.
Rgds,