Help on coding expert advisor on market sessions

To add comments, please log in or register
DroidM
39
DroidM  
I would like help in coding the time when my EA on MT4 is turned on and off.

GMT 8:00am - 12:00pm
GMT 3:00pm - 7:00pm
GMT 12:00am - 5:00am

These are the hours i trade.

What code would i have to use to have my bot run at these times using my MT4 server time.
Thank you.
Keith Watford
Moderator
23572
Keith Watford  
In future please post in the correct section
I will move this topic to the MQL4 and Metatrader 4 section.
Kenneth Parling
13095
Kenneth Parling  
DroidM:
I would like help in coding the time when my EA on MT4 is turned on and off.

GMT 8:00am - 12:00pm
GMT 3:00pm - 7:00pm
GMT 12:00am - 500am

These are the hours i trade.

What code would i have to use to have my bot run at these times using my MT4 server time.
Thank you.

just curious, what's 500am? never seen that one before

Gabriel Beaird
1085
Gabriel Beaird  


MAYBE THIS?


v COPY HERE v

// Variables (Global Variables)

class v

{

public:

};




//--

// Externs (Global Variables)

input string inp1_TimeStart = "08:00";

input string inp1_TimeEnd = "12:00";

input string inp2_TimeStart = "15:00";

input string inp2_TimeEnd = "19:00";

input string inp3_TimeStart = "20:00";

input string inp3_TimeEnd = "00:01";

class _externs

{

public:

static string inp1_TimeStart;

static string inp1_TimeEnd;

static string inp2_TimeStart;

static string inp2_TimeEnd;

static string inp3_TimeStart;

static string inp3_TimeEnd;

};

string _externs::inp1_TimeStart;

string _externs::inp1_TimeEnd;

string _externs::inp2_TimeStart;

string _externs::inp2_TimeEnd;

string _externs::inp3_TimeStart;

string _externs::inp3_TimeEnd;


^ COPY TO HERE ^


v EXTRA POSSIBLE CODE v


// Initiate Constants

c::MagicStart = MagicStart;




// Initiate Externs
_externs::inp1_TimeStart = inp1_TimeStart;
_externs::inp1_TimeEnd = inp1_TimeEnd;
_externs::inp2_TimeStart = inp2_TimeStart;
_externs::inp2_TimeEnd = inp2_TimeEnd;
_externs::inp3_TimeStart = inp3_TimeStart;

_externs::inp3_TimeEnd = inp3_TimeEnd;




DroidM
39
DroidM  
Gabriel Beaird:


MAYBE THIS?


v COPY HERE v

// Variables (Global Variables)

class v

{

public:

};




//--

// Externs (Global Variables)

input string inp1_TimeStart = "08:00";

input string inp1_TimeEnd = "12:00";

input string inp2_TimeStart = "15:00";

input string inp2_TimeEnd = "19:00";

input string inp3_TimeStart = "20:00";

input string inp3_TimeEnd = "00:01";

class _externs

{

public:

static string inp1_TimeStart;

static string inp1_TimeEnd;

static string inp2_TimeStart;

static string inp2_TimeEnd;

static string inp3_TimeStart;

static string inp3_TimeEnd;

};

string _externs::inp1_TimeStart;

string _externs::inp1_TimeEnd;

string _externs::inp2_TimeStart;

string _externs::inp2_TimeEnd;

string _externs::inp3_TimeStart;

string _externs::inp3_TimeEnd;


^ COPY TO HERE ^


v EXTRA POSSIBLE CODE v


// Initiate Constants

c::MagicStart = MagicStart;




// Initiate Externs
_externs::inp1_TimeStart = inp1_TimeStart;
_externs::inp1_TimeEnd = inp1_TimeEnd;
_externs::inp2_TimeStart = inp2_TimeStart;
_externs::inp2_TimeEnd = inp2_TimeEnd;
_externs::inp3_TimeStart = inp3_TimeStart;

_externs::inp3_TimeEnd = inp3_TimeEnd;




Gabriel Beaird:


MAYBE THIS?


v COPY HERE v

// Variables (Global Variables)

class v

{

public:

};




//--

// Externs (Global Variables)

input string inp1_TimeStart = "08:00";

input string inp1_TimeEnd = "12:00";

input string inp2_TimeStart = "15:00";

input string inp2_TimeEnd = "19:00";

input string inp3_TimeStart = "20:00";

input string inp3_TimeEnd = "00:01";

class _externs

{

public:

static string inp1_TimeStart;

static string inp1_TimeEnd;

static string inp2_TimeStart;

static string inp2_TimeEnd;

static string inp3_TimeStart;

static string inp3_TimeEnd;

};

string _externs::inp1_TimeStart;

string _externs::inp1_TimeEnd;

string _externs::inp2_TimeStart;

string _externs::inp2_TimeEnd;

string _externs::inp3_TimeStart;

string _externs::inp3_TimeEnd;


^ COPY TO HERE ^


v EXTRA POSSIBLE CODE v


// Initiate Constants

c::MagicStart = MagicStart;




// Initiate Externs
_externs::inp1_TimeStart = inp1_TimeStart;
_externs::inp1_TimeEnd = inp1_TimeEnd;
_externs::inp2_TimeStart = inp2_TimeStart;
_externs::inp2_TimeEnd = inp2_TimeEnd;
_externs::inp3_TimeStart = inp3_TimeStart;

_externs::inp3_TimeEnd = inp3_TimeEnd;




This was so detailed, thank you so much.
To add comments, please log in or register