string of code to discard all records, memory of an EA?

 

so, lets say - i have an EA, which for some procedures uses some info from previous trades.

in my case - after a trade has hit TP, another trade is opened, in the same direction, but the parameters of the trade are changed.

is it possible to invoke a string of code, that would erase all such info, after a specific event (in this case, all trades are closed after X % equity growth).


big thanks to anyone reading.

 
I think you need to provide a little more info.  Your question is very ambigious.  Sorry...
 
cornelis duiker:
I think you need to provide a little more info.  Your question is very ambigious.  Sorry...

oh.

well, question would be -

is it possible to "re-instate" the EA to the starting point?

clearing all records, caches, every info it has gathered for its own purposes?


on a live test, that would be simple - closing the terminal, and attaching the EA anew. but thats kinda manual, dont you think?

 
Nauris Mucenieks:

oh.

well, question would be -

is it possible to "re-instate" the EA to the starting point?

clearing all records, caches, every info it has gathered for its own purposes?


on a live test, that would be simple - closing the terminal, and attaching the EA anew. but thats kinda manual, dont you think?


I've never used it in an EA so can't guarantee this will work but I use this line a lot in indicators to "re-start" them:

ChartSetSymbolPeriod(0,NULL,0);

 It basically just re-loads the current symbol and time frame which forces the indy to de-init and re-init. With an EA, you may also need to make sure in Options->Expert Advisors you uncheck the option "Disable trading when chart symbol or period has changed". Again, I've never tried it with an EA so you'll need to experiment.

Of course, it will also depend on the logic of your EA as to what happens when the EA reloads. If it sets/gets any global variables then you may also need to deal with them during init.

 
Stuart Browne:


I've never used it in an EA so can't guarantee this will work but I use this line a lot in indicators to "re-start" them:

 It basically just re-loads the current symbol and time frame which forces the indy to de-init and re-init. With an EA, you may also need to make sure in Options->Expert Advisors you uncheck the option "Disable trading when chart symbol or period has changed". Again, I've never tried it with an EA so you'll need to experiment.

Of course, it will also depend on the logic of your EA as to what happens when the EA reloads. If it sets/gets any global variables then you may also need to deal with them during init.

i played around with it a bit, sadly has no real effect, or at least doesnt do what i hoped for.

real neat trick tho, ill test it out on live, see what it does.

now at least i know for sure what i am looking for :

a function that will " de-init and re-init " an EA.


big thanks, by the way.

 
Nauris Mucenieks:

i played around with it a bit, sadly has no real effect, or at least doesnt do what i hoped for.

real neat trick tho, ill test it out on live, see what it does.

now at least i know for sure what i am looking for :

a function that will " de-init and re-init " an EA.


big thanks, by the way.

Very welcome. Do you actually have the mq code or only an ex file?
 
Stuart Browne:
Very welcome. Do you actually have the mq code or only an ex file?
i have the code.
 
Nauris Mucenieks:
i have the code.
OK, just re-reading your original request. Can you not just check for % equity growth and when it hits your limit, close out all orders and reset all related variables?
 
Stuart Browne:
OK, just re-reading your original request. Can you not just check for % equity growth and when it hits your limit, close out all orders and reset all related variables?

not trying to sound silly, but thats kinda what im trying [?] to do.

i lack skill, sadly.


p.s.

if ran manually, it would be a different story - but without proper backtesting - its more like a game of chance.

 
Nauris Mucenieks:

not trying to sound silly, but thats kinda what im trying [?] to do.

i lack skill, sadly.


p.s.

if ran manually, it would be a different story - but without proper backtesting - its more like a game of chance.

hehehe no problem. Might be time to call in a coder mate. Without seeing the code it's hard to say but it really shouldn't be that difficult so shouldn't cost too much.
 
Stuart Browne:
hehehe no problem. Might be time to call in a coder mate. Without seeing the code it's hard to say but it really shouldn't be that difficult so shouldn't cost too much.
thanks for the suggestion, if i wont be able to do it myself, ill probably have to.
Reason: