I am writing an EA and I ran into a problem. My Expert Advisor should perform calculations every minute for a given number of minutes. After that, all data should be reset and calculations should be performed from the beginning.
And so the cycle by cycle. The time cycle is from 5 to 60 minutes. Please advise me how to describe this correctly in the code?
For now the loop of 5 minutes looks like this:
if ((TimeMinute(TimeCurrent()))==time1)
Price20=koef_10;
if ((TimeMinute(TimeCurrent()))==time2)
Price20=koef_10;
if ((TimeMinute(TimeCurrent()))==time3)
Price20=koef_10;
if ((TimeMinute(TimeCurrent()))==time4)
Price20=koef_10;
if ((TimeMinute(TimeCurrent()))==time5)
Price20=koef_10;
I am writing an EA and I ran into a problem. My Expert Advisor should perform calculations every minute for a given number of minutes. After that, all data should be reset and calculations should be performed from the beginning.
And so the cycle by cycle. The time cycle is from 5 to 60 minutes. Please advise me how to describe this correctly in the code?
For now the loop of 5 minutes looks like this:
I would be grateful for any help.
I propose this solution:
//+------------------------------------------------------------------+//| Circle X Minutes.mq4 |//| Copyright 2012, Roll |//| https://www.mql5.com/ru/users/roll |//+------------------------------------------------------------------+#property copyright "Copyright 2012, Roll"#property link "https://www.mql5.com/ru/users/roll"externint minut=5;datetime t;int k;
//+------------------------------------------------------------------+int init(){t=0;k=minut;return(0);}int deinit(){return(0);}
//+------------------------------------------------------------------+int start(){if(k>60)k=0;if(k==0)return(0);F1();if(k>0){if(F()==true)k--;}return(0);}
void F1(){if(t==0&&TimeSeconds(TimeCurrent())>=0)
{Alert("цикл из ", minut," минут - УСТАНОВКА: время сервера - ",TimeToStr(TimeCurrent(),
TIME_SECONDS));t=TimeCurrent();}}
bool F(){if(t!=0&&t<TimeCurrent()&&TimeSeconds(TimeCurrent())>=0)
{Alert("цикл из ", minut," минут - ПРОВЕРКА: время сервера - ",TimeToStr(TimeCurrent(),
TIME_SECONDS));t=TimeCurrent()+59;return(true);}}
I need your advice on this question: How to write in the code of the Expert Advisor so that from the balance it was taking a predetermined amount, say our balance = $80 every time the balance = $80 + $10 Expert Advisorfrom the biggest minus took $5, reducing the lot and closing these 10 $ and a new report started at $85
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.
Thanks a lot Roman, it all worked out! :) My name is "RAVI".
Good afternoon, gentlemen.
I need your advice on the following question:
I am writing an EA and I ran into a problem. My Expert Advisor should perform calculations every minute for a given number of minutes. After that, all data should be reset and calculations should be performed from the beginning.
And so the cycle by cycle. The time cycle is from 5 to 60 minutes. Please advise me how to describe this correctly in the code?
For now the loop of 5 minutes looks like this:
I would be grateful for any help.
'MODE_HIGH' - variable expected C:\Program Files (x86)\FXstart - MetaTrader\experts\indicators\policyclics.mq4 (46, 52)
MODE_HIGH is the identifier taken from the corresponding table è....
Good afternoon, gentlemen.
I need your advice on this question:
I am writing an EA and I ran into a problem. My Expert Advisor should perform calculations every minute for a given number of minutes. After that, all data should be reset and calculations should be performed from the beginning.
And so the cycle by cycle. The time cycle is from 5 to 60 minutes. Please advise me how to describe this correctly in the code?
For now the loop of 5 minutes looks like this:
I would be grateful for any help.
I propose this solution:
I suggest this solution:
It's not working. Here's a screenshot:
The timing seems to be confused + after the end of the first cycle, a new one has not started.
I can't figure out how to calculate the lifetime from pattern formation to 0 bar.
If the pattern exists and there is no hard reference to price and time.
Good afternoon, gentlemen.
I need your advice on this question: How to write in the code of the Expert Advisor so that from the balance it was taking a predetermined amount, say our balance = $80 every time the balance = $80 + $10 Expert Advisor from the biggest minus took $5, reducing the lot and closing these 10 $ and a new report started at $85