Please help me to close order once the target profit has been made for the manual trade for orders more than 1
FES:
I manually place order for the hedging pairs EURUSD & USDCHF at buy at the same time.
I would like to use the ea or Experts>Script to close order once there is profit made at my target profit.
Can someone pls guide me.
I am a newbie in writing ea.. hope there is someone can guide me..
Thanks
if(AccountProfit()>=MinProfit) { int total=OrdersTotal(); for (int cnt=total-1;cnt>=0;cnt--) { if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) { { if (OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),1); if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),1); } } } }Cheers
int total=OrdersTotal();
for (int cnt=total-1;cnt>=0;cnt--)
{
if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))
{
if (OrderProfit()>=MinProfit &&OrderType()==OP_BUY)
{
OrderClose(OrderTicket(),OrderLots(),Bid,1);
}
if (OrderProfit()>=MinProfit &&OrderType()==OP_SELL)
{
OrderClose(OrderTicket(),OrderLots(),Ask,1);
}
}
}
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I manually place order for the hedging pairs EURUSD & USDCHF at buy at the same time.
I would like to use the ea or Experts>Script to close order once there is profit made at my target profit.
Can someone pls guide me.
I am a newbie in writing ea.. hope there is someone can guide me..
Thanks