Can someone help this small pice of code

 

(1) I have function that will move stoploss to point [a] when; ( xyz.. && breakeven_active=false )

(2) I have a function thats moves stoploss from point [a] to breakeven when; (close 0 > close 1)

My problem is that the actions carry out as the should as i have included a couple of bools. However when i restart my platform all memory of true of false in the bools is lost and gone back to the defaults.

how do i get the ea to memorise or store the fact that a action has carried out.

here is a pice of code.. Can some help me the ea can store the memory that when the ordermodify takes place and bool changes to true. The ea will remember this even when the platform is restarted.

----------------------------------------------

void Breakeven()
{

breakeven_active=false;

if xyz.....

{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,CLR_NONE);

breakeven_active=true;

}

return(0);

}

---------------------------------------------

 

Two solutions:

1. using Global Variables -> https://docs.mql4.com/globals;

2. using files -> https://docs.mql4.com/files.

I like 1.

"Global variables are kept in the client terminal within 4 weeks since the last access <added by me> <even if terminal restarts or shuts off> </added by me>, then they will be deleted automatically. An access to a global variable is not only setting of a new value, but reading of the global variable value, as well." <- https://docs.mql4.com/globals.

 

global variables stores a numeric number so i believe. I need something to store a bool. I am only amature learning to code so excuse me if i seem a dit dumb to some people.

 

Use "1" and "0" instead of "true" and "false".

Reason: