r772ra: For comments on Print. if not needed when working.
Thank you! Can you tell me how you can put a time limit on the EA's work in external settings.
I have added this
int start()
{
if(!isTradeTimeInt(21, 30, 01, 00)) return;
а в конце кода вот это
//+------------------------------------------------------------------+//| Описание : Возвращает флаг разрешения торговли по времени. |//+----------------------------------------------------------------------------+//| Параметры: |//| hb - часы времени начала торговли |//| mb - минуты времени начала торговли |//| he - часы времени окончания торговли |//| me - минуты времени окончания торговли |//+----------------------------------------------------------------------------+bool isTradeTimeInt(int hb=0, int mb=0, int he=0, int me=0) {
datetime db, de; // Время начала и окончания работыint hc; // Часы текущего времени торгового сервера
db=StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+hb+":"+mb);
de=StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+he+":"+me);
hc=TimeHour(TimeCurrent());
if (db>=de) {
if (hc>=he) de+=24*60*60; else db-=24*60*60;
}
if (TimeCurrent()>=db && TimeCurrent()<=de) return(True);
elsereturn(False);
}
Thank you! Can you tell me how you can put a time limit on the EA's external settings?
Added this
externint StartHour = 21; // Время закрытия, часыexternint StartMinute = 30; // Время закрытия, минутыexternint CloseHour = 01; // Время закрытия, часыexternint CloseMinute = 0; // Время закрытия, минуты//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+intOnInit()
{
//---//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
}
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+voidOnTick()
{
if(isTradeTimeInt(StartHour,StartMinute,CloseHour,CloseMinute))
{
//Здесь то,,,,//что работает, в этом диапозоне времени
}
}
//+------------------------------------------------------------------+//+------------------------------------------------------------------+//| Описание : Возвращает флаг разрешения торговли по времени. |//+----------------------------------------------------------------------------+//| Параметры: |//| hb - часы времени начала торговли |//| mb - минуты времени начала торговли |//| he - часы времени окончания торговли |//| me - минуты времени окончания торговли |//+----------------------------------------------------------------------------+bool isTradeTimeInt(int hb=0, int mb=0, int he=0, int me=0) {
datetime db, de; // Время начала и окончания работыint hc; // Часы текущего времени торгового сервера
db=StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+(string)hb+":"+(string)mb);
de=StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+(string)he+":"+(string)me);
hc=TimeHour(TimeCurrent());
if (db>=de) {
if (hc>=he) de+=24*60*60; else db-=24*60*60;
}
if (TimeCurrent()>=db && TimeCurrent()<=de) return(True);
elsereturn(False);
}
Can you please tell me if it is possible to prescribe the angle of slope of the moving average or price intersection with the moving average at a certain angle?
Profitov: Can you please tell me if it is possible to prescribe the angle of slope of moving average or price intersection with moving average at a certain angle?
Now they'll start explaining to you that the angle depends on the chart scale and it's impossible to do that... But if you take not the angle, but only the tangent of that angle, you can do what you want.
My Expert Advisor, in int init(), first tests a 1000 bar history, then start(). In the tester this process takes 3-4 seconds, but in real life it takes about 8 minutes. What can it be related to? How can I make the testing take as much time as in the tester?
Profitov: Can you please tell me if it is possible to prescribe the angle of slope of the moving average or price intersection with the moving average at a certain angle?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Thank you!
How do we get out? return(0); gives me an error.
Depending on function type. It's not start() but OnTick(), it's void, so just return;
return;For comments on Print. if not needed when working.
Thank you! Can you tell me how you can put a time limit on the EA's work in external settings.
I have added this
Depending on the function type. Now it's not start() but OnTick(), it's void, so just return;
Thank you!
Thank you! Can you tell me how you can put a time limit on the EA's external settings?
Added this
Can an EA display an indicator? Alternative to ChartIndicatorAdd in MQL5.
And where can I find an example of an EA that performs calculations based on a custom indicator?
Can you please tell me if it is possible to prescribe the angle of slope of moving average or price intersection with moving average at a certain angle?
But if you take not the angle, but only the tangent of that angle, you can do what you want.
My Expert Advisor, in int init(), first tests a 1000 bar history, then start(). In the tester this process takes 3-4 seconds, but in real life it takes about 8 minutes.
What can it be related to? How can I make the testing take as much time as in the tester?
Can an EA display an indicator? Alternative to ChartIndicatorAdd in MQL5.
And where can I find an example of an EA that performs calculations based on a custom indicator?
Can you please tell me if it is possible to prescribe the angle of slope of the moving average or price intersection with the moving average at a certain angle?
https://book.mql4.com/ru/samples/iroc