Download MetaTrader 5

Scripts: Pausing execution of EA until certain time has passed

To add comments, please log in or register
They are already making profit using the Market. You can join them!
MetaQuotes Software Corp.
Moderator
181107
MetaQuotes Software Corp. 2009.11.19 12:38 

Pausing execution of EA until certain time has passed:

This code will get the current time , wait until a certain amount of Seconds has passed and then continue processing.

Author: buju

whroeder1
14489
whroeder1 2009.11.19 19:03  

Or a simple static variable, much easier:

start(){
  static datetime Time.update;			// No open order,
  if (CurTime() < Time.update)	return(0);	// Can't trade yet.
//...
  if (!Compute()) {		                // Not good enough
    Time.update = CurTime() + X*60;	        // continue waiting X minutes.
  //Time.update = Time[0] + Period()*60;	// continue waiting for next bar.
    //...
MQL4 Comments
16319
MQL4 Comments 2010.05.11 01:03  

I think this might be a starting point for what I am Looking for. I want to add entry and exit times to an EA. Example would be I only want to trade the EURUSD overnight from 12am EST to 6am and or for the Opening of our US Stock Market. As of right now the EA I have been testing tests 24 hrs of trading. Would appreciate any help on this. I am just learning how to code etc.


Thanks,

Jim Contant

"Jims Trading Machine"

To add comments, please log in or register