any code to share?
- How can we using code DETERMINE How many EA is running and attached the chart?
- How to create a trial edition for my trendline indicator?
- How can I let MT5 client download history data from year 2002 before EA run
void OnTick() {
int gmt_hour=TimeHour(TimeGMT());
if(s>e) {
if(gmt_hour>=s) {
start_time=s;
end_time=24+e;
} else {
start_time=0;
end_time=e;
}
} else { start_time=s; end_time=e; }
if(gmt_hour>=start_time && gmt_hour<=end_time) return(1);
return(0);
}
//call the function
if(TimeAllow(23,9)>0) {
//your code here...}
}
int TimeAllow(int s, int e) {
int start_time, end_time;int gmt_hour=TimeHour(TimeGMT());
if(s>e) {
if(gmt_hour>=s) {
start_time=s;
end_time=24+e;
} else {
start_time=0;
end_time=e;
}
} else { start_time=s; end_time=e; }
if(gmt_hour>=start_time && gmt_hour<=end_time) return(1);
return(0);
}
Abdul Rahman:
many thanks
void OnTick() {
int gmt_hour=TimeHour(TimeGMT());
if(s>e) {
if(gmt_hour>=s) {
start_time=s;
end_time=24+e;
} else {
start_time=0;
end_time=e;
}
} else { start_time=s; end_time=e; }
if(gmt_hour>=start_time && gmt_hour<=end_time) return(1);
return(0);
}
//call the function
if(TimeAllow(23,9)>0) {
//your code here...}
}
int TimeAllow(int s, int e) {
int start_time, end_time;int gmt_hour=TimeHour(TimeGMT());
if(s>e) {
if(gmt_hour>=s) {
start_time=s;
end_time=24+e;
} else {
start_time=0;
end_time=e;
}
} else { start_time=s; end_time=e; }
if(gmt_hour>=start_time && gmt_hour<=end_time) return(1);
return(0);
}
I use something like this ...
It works fine ...
input bool UseTimeFilter = true; //**Use Time Filter For Trading Hours input int StartHour = 18; //**Starting Hour input int EndHour = 6; //**Ending Hour bool EAActivated; ... ... ... int start(){ if((Hour()>=StartHour && Hour()<EndHour && StartHour<EndHour) || ((Hour()>=StartHour || Hour()<EndHour) && StartHour>EndHour)) EAActivated=true; else EAActivated=false; if(EAActivated && ... && ... && ...) OpenBuy(); if(EAActivated && ... && ... && ...) OpenSell(); ... ... ... }
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