//-----------------------------------------------------------------------------+// Функция контроля времени торговли |//-----------------------------------------------------------------------------+bool TradeTime(int StartTradeHour,int EndTradeHour){if(! TradeOfTime){if(DayOfWeek()==6||DayOfWeek()==0){
gTimeEngl="Start trade in 01:00 am";
gTimeRus="Начало торговли в понедельник в 01:00";return(false);}return(true);}if(DayOfWeek()==6||DayOfWeek()==0){
gTimeEngl="Start trade in 01:00 am";
gTimeRus="Начало торговли в понедельник в 01:00";return(false);}if( StartTradeHour< EndTradeHour){if(TimeHour(TimeCurrent())>= StartTradeHour&&TimeHour(TimeCurrent())< EndTradeHour
||( CountOpOrd("0")>0)){
gTimeEngl=StringConcatenate("By the end of trading session :",DoubleToStr(( EndTradeHour-TimeHour(TimeCurrent())),0)," hours");
gTimeRus=StringConcatenate("До конца торговой сессии :",DoubleToStr(( EndTradeHour-TimeHour(TimeCurrent())),0)," часов");return(true);}}if( StartTradeHour> EndTradeHour){if(TimeHour(TimeCurrent())>= StartTradeHour||TimeHour(TimeCurrent())< EndTradeHour
||( CountOpOrd("0")>0)){
gTimeEngl=StringConcatenate("By the end of trading session :",DoubleToStr(( EndTradeHour-TimeHour(TimeCurrent())),0)," hours");
gTimeRus=StringConcatenate("До конца торговой сессии :",DoubleToStr(( EndTradeHour-TimeHour(TimeCurrent())),0)," часов");return(true);}}
gTimeEngl=StringConcatenate("resting to : ", StartTradeHour,": 00");
gTimeRus=StringConcatenate("отдыхаем до : ", StartTradeHour,": 00");return(false);}
//-----------------------------------------------------------------------------+// Определяет дату конца торговли |//-----------------------------------------------------------------------------+bool EndTradeForDateTime(string EndTradeData){//"Enterting Date of End trading in eeee.mm.dd";if( EndTradeData==""){
gInf1rus="Дата конца торговли не определена ";
gInf1engl="Date of the end of trading is not defined ";
gColor1=LimeGreen;return(false);}int EndData=StrToTime(TimeToStr(TimeCurrent(), TIME_DATE));int DataEnd=StrToTime( EndTradeData);if( EndData>= DataEnd){
gInf1rus="Торговля остановленна "+ EndTradeData;
gInf1engl="Trading stopped "+ EndTradeData;
gColor1=Red;return(true);}
gInf1rus="Торговля будет остановленна "+ EndTradeData;
gInf1engl="Trading will be stopped "+ EndTradeData;
gColor1=LimeGreen;return(false);}
Good afternoon, KimIV. I need your advice, or rather help. Found in the database e-Smart_Tralling.mq4, author unknown...but as clarified in the branch the author took in basis - trailing advisor-assistant I.Kim aka KimIV. I tried to change in the code of this EA: 1.to close not all profitable trades, for example, when executing an order, if I put a target and my take profit, advisor does not close this deal; 2. to make it work with all currency pairs and with stoploss. I have not yet had much programming experience, maybe you can suggest me what to change. I am very thankful in advance.
This variant will fit....
Put OpenHour and CloseHour in parameters and those who want to have several intervals will be satisfied:
Make TimeTrade(OpenHour1, CloseHour1), TimeTrade(OpenHour2, CloseHour2), ......
and will combine them as they want.
posted once before
also
and we'll call it a day...and that's the end of it.
"Don't rush to bury us, we've still got things to do here..." :))
Если нужны ещё и минуты для более точного определения временного интервала, например для ночного скальпера.
Of course you need at least dozens of minutes.
You also need days of the week and the ability to set individual times for each day of the week and
Selecting/forbidding a certain day.
Practice shows that the patterns work differently on different days of the week.
A simple formula for the automatic generation of a magik for EAs working simultaneously on different instruments in the same account came to mind.