[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 813

 
artmedia70:
My friends, I searched the site for a long time with various combinations of search queries for the information I need on the subject I'm interested in, but I didn't get any results.
I am interested in the following: Saving data while the Expert Advisor is running in case of emergency terminal shutdown, connection interruption, power outage in the end.
Who knows, please throw me a link to information.
Thank you.

    if (!GlobalVariableCheck(symbol+"_Price")) GlobalVariableSet(symbol+"_Price",0);             //На случай аварийного выхода  
    if (!GlobalVariableCheck(symbol+"_Time")) GlobalVariableSet(symbol+"_Time",0);               //организуем глобальные переменные 
    if (!GlobalVariableCheck(symbol+"_Ticket")) GlobalVariableSet(symbol+"_Ticket",-1);          //для сохранения критических данных

    if (!GlobalVariableCheck("Risk")) GlobalVariableSet("Risk",2);                              //Уровень риска для мультивалютной торговли  

global variables - https://docs.mql4.com/ru/globals

or write the data to a file...

 
glasha:
Dear programmers!
I have a question: how to attach a piece of code to an Expert Advisor that would show a comment for an order.
Files:
 
IgorM:


Thank you. I'll have a look.

Just what I need... Thanks again.

 
DDFedor:

global variables - https://docs.mql4.com/ru/globals

or write the data to a file...

Thank you. But what about the fact that a correct, proper EA should clean up the global variables of the terminal? Yes and there will be too many of them accumulated.
It has a lot of variables that are constantly monitored and have one or another value depending on the situation... Ok, I'll think about it... :)
 
artmedia70:
Thank you. What about the fact that a correct, proper EA should clean up the global terminal variables? Yes and there will be too many of them accumulated.
It has a lot of variables that are constantly monitored and have one or another value depending on the situation... Ok, I'll think about it... :)
When I wrote this, I put all variables, which should be saved into array and saved this array every tick. When initialized, the array is read. It's much easier to create global variables.
 
vasya_vasya:
I wrote such a thing, all variables that need to be stored in an array, and stored this array every tick. During initialization, the array is read. This is done much easier than creating global variables.
Thank you. Good idea! Thank you!
 
I don't get it... I'm opening all positions with the same thousand times-tested function...
It opens all the positions until the slump starts. Then it logs messages
and stops opening everything... ...until it's down.
This is what it says before function call:
2010.08.21 20:32:12 2009.03.27 13:10 Sergitas_v1.03 EURUSD,M5: Open Buy position with lot = 1.53
... and this is after the attempt to open:
2010.08.21 20:32:12 2009.03.27 13:10 Sergitas_v1.03 EURUSD,M5: invalid price 1.33249000 for OrderSend function

Where the wrong price comes from, I have no idea... It's a miracle.
Anybody got any ideas?

 
artmedia70:
I don't get it... I'm opening all positions with the same thousand times-tested function...
It opens all the positions until the slump starts. Then it logs messages
and stops opening everything... ...until it's down.
This is what it says before function call:
2010.08.21 20:32:12 2009.03.27 13:10 Sergitas_v1.03 EURUSD,M5: Open Buy position with lot = 1.53
... and this is after the attempt to open:
2010.08.21 20:32:12 2009.03.27 13:10 Sergitas_v1.03 EURUSD,M5: invalid price 1.33249000 for OrderSend function

Where the wrong price comes from, I have no idea... It's a miracle.
Anybody got any ideas?




Same thoughts as always, Normolysdable(Asc(Bid),Digits)
 
vasya_vasya:
Same thoughts as always, Normolysdable (Ask(Bid),Digits)
I open all positions with the same function, already tested a thousand times...

Everything is already taken into account there, especially those basics...:) The dog is somewhere else...

Ok, I'll keep looking for hedgehogs...

 

Hi all.

I need the tester to output and remember the last open and close price only when the candle is closed. But the tester shows me the open and close value with the appearance of a new tick and does not remember the previous value. How it can be implemented?

Thank you.

Reason: