Hello everyone, I am wanting to make an indicator or EA (without success) that check the profit and if you reach the profit you want it to close the orders, I have a script that close manually and I want to automate it
to MQL4 uses AccountProfit ()
I tried to make the following logic, but I'm not getting any success, someone could help
Hello everyone, I am wanting to make an indicator or EA (without success) that check the profit and if you reach the profit you want it to close all the orders, I have a script that close manually and I want to automate it
to return the profit value according to the documentation MQL4 uses AccountProfit()
I tried to make the following logic, but I'm not getting success, someone could help
if(AccountProfit()>10.00 || AccountProfit()<-10.00) { for(int x=OrdersTotal()-1;x>=0;x--) { if(!OrderSelect(x,SELECT_BY_POS,MODE_TRADES)) continue; switch(OrderType()) { case OP_BUY : if(!OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NONE)){ Alert("fail deleting trade order"); }; break; case OP_SELL : if(!OrderClose(OrderTicket(),OrderLots(),Ask,3,CLR_NONE)){ Alert("fail deleting trade order"); }; break; default : break; } } }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone, I am wanting to make an indicator or EA (without success) that check the profit and if you reach the profit you want it to close all the orders, I have a script that close manually and I want to automate it
to return the profit value according to the documentation MQL4 uses AccountProfit()
I tried to make the following logic, but I'm not getting success, someone could help