Restart ea
-
Is there a way to make the ea to restart itself after lets say profits has been closed ?
because in most of my ea's i work with alot of orders along a large moving candle , but after the profit has closed it starts to loose track ,
So if the reset part can be done i was thinking of adding a filter that it dosnt trade when the body of a candle is above x pips and then restart on every profit close , so in my insane mind it would be able to trade along a big candle and if that candle drops to the required amount of pips on the candle body it will do the same thing again and again .
-
hmm... how about using the trade group number, set it as a variable - when you need to "restart", increase that variable by +1, so the group number will be different from there on
-
hmmm that might work acutally , was hoping to hear your side of it

Thought of a solution that might work , if no trades - check if the body is below 10 pips set flag trading to true otherwise set it to false . that might work .
Or trade close - set flag to true - terminate and in deinit set flag to false , i dont know it that would save the complete terminate block though haha

-
https://fxdreema.com/shared/ZupRJjCQc
Made it like this and it seems to work wonders actually

its always nice to have someone to throw ideas at , not only to get a solution to the problem but to make the brain to maybe find the solution by itself

-
haha, I agree on that

-
I came up with an simple idea of how to restart the ea , I used when trades closed- no trades - apply template .
But the first day i got an insane result , but now it seems to restart some , and other charts the ea is simply deleted .
tried terminate as well but that spams termination messages on the platform , and didnt really work .
It should work as it is now , but it messes up and i dont know why ..Can you see a wrong with my strategy ?
-
@timmyhanke
Nice work
I haven't done anything similar to this, and can't spot any obvious mistakes in the logic.. -
There is a function to kill the EA - https://www.mql5.com/en/docs/common/expertremove - but I don't know how to restart it
-
Thank you for your suggestion, but wont apply template do the same , when the ea is inside template already , so it reloads the ea when the trades are closed

-
I think it depends on what kind of restart he needs. Because the EA restarts also when you modify its properties, but this restart is not full restart and some global variables still keep their values.