TURN Off MT4 Autotrading
-
Hi there, Someone knows how can I close a trade and turn off the live trading of MT4? Thanks

-
@ambrogio I don't think there is an API function available to do so. At least I'm not aware of.
If it's sufficient to stop the EA, you may set a flag that you check before opening new trades.You may also do so by mql4 code .. see example here https://www.mql5.com/en/forum/113277
However, they suggest a software that auto-controles the mt4 window. But I have no clue how your EA might trigger that. -
@trader-philipps Perhaps this is simpler: close all the trades of another expert on another chart and prevent it from opening new orders (end the other expert)
@miro1360 some advice? -
Simply change the number ID of blocks 5 and 13. That way you will turn off autotrading first and then the EA will be terminated, exactly in that order.
-
@l-andorrà thanks for your answer but the block 13 is empty, i need to know how stop autotrading with my expert.
I'll explain: i need to close all the trades of another expert (not created with fxdreema) on another chart and prevent it from opening new orders (turn off the other expert) -
@ambrogio said in TURN Off MT4 Autotrading:
@trader-philipps Perhaps this is simpler: close all the trades of another expert on another chart and prevent it from opening new orders (end the other expert)
@miro1360 some advice?You may close other expert's orders, but I have no clue how to avoid them to open new ones.
-
@trader-philipps thank you anyway

-
@trader-philipps said in TURN Off MT4 Autotrading:
You may close other expert's orders, but I have no clue how to avoid them to open new ones.
Me neither.
-
@ambrogio I did some documentation and I found all these...
There is some code down here, and I'm thinking setting up a boolean if that's possible.
https://docs.mql4.com/runtime/tradepermission
But closing Auto trading feature would terminate the handler EA itself.
So maybe trying to get the magic number of the running EAs and terminate those only would be great. Then in this Handler EA, you could even set up some conditions to check for a certain market context, and make some kind of a Manager EA.
Also, another way to go, would be to close certain charts. Closing the chart with some EA, closes the respective EA as far as I know.
... Or I found this
// Deletes the Expert Advisor form the appropriate chart
bool EXPERT::Remove( const long Chart_ID = 0 );
don't know if this is for mt4 or mt5.
Also...
It says here
https://www.metatrader4.com/en/trading-platform/help/autotrading/experts/experts_remove
that "the expert can be removed from the chart at profile or template change" so there could be a function to change template on some chart, also.
Examples here
https://www.mql5.com/en/docs/chart_operations/chartapplytemplate -
@l-andorrà thank you anyway
-
@cpxiom thank you, i'm working on it

-
TURN off MT4 Autotrading