Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1126

 
people, can you please tell me how to make the graphs in the terminal to save the markup after switching on again?
I saved in csv format, that didn't work
 
Seselio:

Есть условие для открытия ордера BUY. Открывается ордер, как сделать переход к SELL условию после закрытия BUY ордера?

if(High[1]-Close[1]>=NormalizeDouble(xbs1*_Point,_Digits))
   {
    int b_tik=OrderSend(_Symbol,OP_BUY,Lots,Ask,Slip,Low[2]-sl,High[1]+ tp,"",Magic,0,clrBlue)==true; //открытие ордера
      
       GlobalVariableSet("B_order",0); // Больше не ищем вход Buy

       //-----?????
       GlobalVariableSet("S_order",1); // Переходим к поиску Sell
       return;
   }
Exactly the same as for Bai. Your logic here is incomplete even for Bai, I would suggest that it should be so:
if(GlobalVariableGet("B_order",1)) //ищем  вход Buy
if(High[1]-Close[1]>=NormalizeDouble(xbs1*_Point,_Digits))
   {
    int b_tik=OrderSend(_Symbol,OP_BUY,Lots,Ask,Slip,Low[2]-sl,High[1]+ tp,"",Magic,0,clrBlue)==true; //открытие ордера
      
       GlobalVariableSet("B_order",0); // Больше не ищем вход Buy

       //-----?????
       GlobalVariableSet("S_order",1); // Переходим к поиску Sell
       return;
   }
else if(GlobalVariableGet("S_order",1))// ищем  вход Sell
{Условие для SELL}
 

I'm totally confused with these bugs, I've started to write them and then they started going this way and that. Shortly:

Question: I have tested it on demo with Alert and checked how it works. I have intentionally made in my EA the wrong order trying to open, it got error code 4051, i.e. I set this function GetLastError() before opening an order and after it was opened. I got it: 1 tick from the start of the EA, Error call--> 0 --> tried to open an order with wrong conditions --> Error call--> 4051, and when the 2nd tick has triggered the first call already shows 4051 and my EA does not send any more requests until I have dealt with the EA. The GetLastError() function calls the last error from terminal or from server and how to reset it? I mean, if for example "general error" code 2, and 5 min later the server will be working normally, the server will inform me that there is no error. In short, confused in this logic, help who can. Thought I got here recently corresponded here, it turns out I misunderstood.

Справочник MQL4
Справочник MQL4
  • docs.mql4.com
Справочник MQL4
 
Evgeniy Oshurkevich:

I'm totally confused with these bugs, I've started to write them and then they started going this way and that. Shortly:

Question: I have tested it on demo with Alert and checked how it works. I have intentionally made in my EA the wrong order trying to open, it got error code 4051, i.e. I set this function GetLastError() before opening an order and after it was opened. I got it: 1 tick from the start of the EA, Error call--> 0 --> tried to open an order with wrong conditions --> Error call--> 4051, and when the 2nd tick has triggered the first call already shows 4051 and my EA does not send any more requests until I have dealt with the EA. The GetLastError() function calls the last error from terminal or from server and how to reset it? I mean, if for example "general error" code 2, and 5 min later the server will be working normally, the server will inform me that there is no error. In short, confused in this logic, help who can. Thought I got here recently corresponded here, it turns out I misunderstood.

Try resetting error with ResetLastError() function;
 
Alekseu Fedotov:
Try resetting the error with ResetLastError();
Thank you
 

EXCEPTION!!!!!!!!! Dear people! Don't be surprised that you are being harassed by newbies!!! What's with the search engine at???? I'm some kind of expert here for 2 weeks now, you should have seen my face when I decided to check and find out more about OrderSend() in search engine!!!! Poor newbies. Well, okay, in the address bar I change it to 4 instead of 5. I'm not authorized there, okay, I press enter and I am back to mql5. If I'm not logged in to Mql4, the search engine does not work.

And also on the forum a lot of smart people write "what is the search engine for?" or "look in the search engine", "we're kind of lazy," etc. no offense

 

In the documentation:

GetLastError

Returns the contents of the system variable_LastError.

intGetLastError();

Returned value

Returns the value of the lasterror that occurred during the execution of an mql4 program.

Note .

After the function is called, the content of the _LastError variable is cleared.


It is clearly written in the note that _LastError is cle ared to zero.

Let's read more about_LastError.

int _LastError

The _LastError variable stores the value of the lasterror that occurred during the execution of the mql4 program. TheResetLastError()function can reset the value to zero.

You can also use theGetLastError() function to get the error code.


It says: You can reset thevalue to zero with theResetLastError() function. Why should it reset if it says_LastError resets itself to zero?

Ok, keep readingResetLastError().

ResetLastError

Sets the value of the predefined_LastError variable to zero.

voidResetLastError();

Returned value

No return value.

Note

GetLastError() clears the_LastError variable.

TheGetLastError()functionclears the_LastError variable.

Then why do I needResetLastError(); ?????

And how will I know later what error occurred if there is 0 after the second call ofGetLastError()? Because it clears_LastError.

By the way, in the demo nowGetLastError() shows the same error on every tick and doesn't reset it.

I.e., we got the same error on the 1st tick and on the 2nd tick, my EA does not send the request for opening because it has already seen the last error

I kinda slept last night, haven't had a drink since New Year's Eve.



_LastError - Предопределенные переменные - Справочник MQL4
_LastError - Предопределенные переменные - Справочник MQL4
  • docs.mql4.com
_LastError - Предопределенные переменные - Справочник MQL4
 
Evgeniy Oshurkevich:

In the documentation:

GetLastError

Returns the contents of the_LastError system variable.



Now read normal MT5 documentation, now some old functions work exactly as it is written, because mt4 documentation is outdated and there are a lot of things not fixed yet.

GetLastError

Returns the content of the_LastError system variable.

intGetLastError();

Returned value

Returns the value of the last error that occurred during the execution of the mql5 program.

Note

After the function is called, the contents of the _LastError variable is not cleared. TheResetLastError() function must be called to reset this variable to zero.

See also

Trade server return codes

 
Evgeniy Oshurkevich:

I kind of slept through the night, I haven't had a drink since New Year's Eve.

Well I have been since 1997)

See, there is a tick and with it a signal, and if you get an error, it needs to be processed. Processed and query again, but before query you can zero the variable with the error, then the next query if there is an error, it will go back into the variable, but if there is no error, it will be "0".

You don't have to zero the variable, but if there is an error, it will return a new value. In any case, you should not be interested in the error that you had last time on the last tick, you should process only what you have "now".

 
Sergey Gritsay:

And now read the normal MT5 documentation, now some of the old functions work exactly as written in it, as the mt4 documentation is outdated and there are a lot of things not yet fixed.

GetLastError

Returns the content of the_LastError system variable.

intGetLastError();

Returned value

Returns the value of the last error that occurred during the execution of the mql5 program.

Note

After the function is called, the contents of the _LastError variable is not cleared. TheResetLastError() function must be called to reset this variable to zero.

See also

Trade server return codes

So again, this is on mql5. And I need it on mql4.
Reason: