Trying to make an Equity trawl to fix it before the extra orders come in:
wrote this code:
int init(){//Наиль - фиксируем сумму средств на начало работы советника
EquityStart=AccountEquity();
StartBalance=AccountBalance();if(GlobalVariableSet("EquityStart", EquityStart)==0)if(GlobalVariableSet("StartBalance", StartBalance)==0)return(false);//---- продолжение обработки//===============//трал у меня выведен в отдельную функцию:bool fPrEquity(){if(! PrEquity)return(true);staticbool ClAllFlag=false;double Pr2=0;
StartBalance=GlobalVariableGet("StartBalance");
Pr2=AccountEquity()- StartBalance;if( Pr2>= ProcentToclose/100.0*AccountEquity()){Print("Средстава возросли. Закрываем все!!!");
ClAllFlag=true;
StartBalance=AccountEquity();GlobalVariableSet("StartBalans", StartBalance);}if( ClAllFlag){if( fOrderCloseMarket(true,true)==0){
ClAllFlag=false;return(true);}else{return(false);}}return(true);}
Trying to make an Equity trawl to fix it before the extra orders come in:
wrote this code:
But the EA starts working like this:
Who can tell me what the problem is?
After the first execution of the function, the value of the ClAllFlag variable takes the value true and does not change its value. The variable type should be simply bool.
После первого запуска функции значение переменной ClAllFlag принимает значение true и больше не меняет своего значения. Надо бы тип переменной сделать просто bool.
you mean to remove static before bool ClAllFlag ?
But this variable is used in other places in the code as well... where all orders are closed.
I've tried this - it doesn't help.
Confused by the constant messages in the log...Maybe somewhere
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.
Почему-то не работает, помогите разобраться в чём проблема! Спасибо!
brackets are missing
Trying to make an Equity trawl to fix it before the extra orders come in:
wrote this code:
But the EA starts working like this:
Who can tell me what the problem is?
Пытаюсь сделать трал Эквити, чтобы зафиксировать его раньше, чем наберет лишние ордера:
написал такой код:
Но советник начинает работать так:
Кто подскажет, в чем проблема?
You seem to be making the wrong comparison:
Вы, кажется, не с тем сравниваете:
Fixed it, but it didn't help...
By the way, the log always says that
Средстава возросли. Закрываем все!!!and writes the amount of equity.
Maybe it's something to do with cycles?
Trying to make an Equity trawl to fix it before the extra orders come in:
wrote this code:
But the EA starts working like this:
Who can tell me what the problem is?
After the first execution of the function, the value of the ClAllFlag variable takes the value true and does not change its value. The variable type should be simply bool.
Explain what I'm doing wrong
I get the error that there is no directory on the ftp server, but I know for sure it is there, where did I go wrong?
После первого запуска функции значение переменной ClAllFlag принимает значение true и больше не меняет своего значения. Надо бы тип переменной сделать просто bool.
you mean to remove static before bool ClAllFlag ?
But this variable is used in other places in the code as well... where all orders are closed.
I've tried this - it doesn't help.
Confused by the constant messages in the log...Maybe somewhere
returnis it worthless?you mean remove static before bool ClAllFlag ?
But this variable is used in other places in the code... where all the orders are closed.
I tried this - it doesn't help.
I'm confused by constant messages in the log... Maybe it's somewhere
>> is it worthless?What is Pr2 equal to?
Probably you have to just reprinter the values.