stopping and starting EA by time
string start = "06:00"; string finish = "12:00"; datetime curT = TimeCurrent(); datetime s_time = StringToTime( TimeToString( curT, TIME_DATE ) + " " + start ); datetime f_time = StringToTime( TimeToString( curT, TIME_DATE ) + " " + finish ); if ( curT < s_time ) { return; } //--wait till time is ok to open if ( curT >= f_time ) { CloseAll(); return; } //--close all if finish time reached //--do the job here
Hi
I want to add to my EA option of stopping and starting by time . I mean :
1 . start time of trading
2. stop time of trading
3. closing all open positions at stop time (never mind win or loss )
thanks