To close all trade start from latest ID :
for (int cnt = total-1 ; cnt >=0 ; cnt--)
. Hope this help
if you post the EA I can take a look at it. Also, post code within code brackets so that it is easy to read.
Also, look at this line ---> OrderClose(OrderTicket(),OrderLots(),Bid,spread,Bl ack);
it should be ---> OrderClose(OrderTicket(),OrderLots(),Bid,spread,Black);
& this line ---> OrderClose(OrderTicket(),OrderLots(),Ask,spread,Bl ack);
should be ---> OrderClose(OrderTicket(),OrderLots(),Ask,spread,Black);
Give this article a look:
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 tried this code
** totalprofit = all profit from floating orders**
if(totalprofit>300)CloseAll();
//------------------
void CloseAll()
{ int spread = MathRound((Ask-Bid)/Point);
int total = OrdersTotal();
for (int cnt = 0 ; cnt < total ; cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,spread,Black);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,spread,Black);
}
}
}
//-----------------------
it's dose'nt work .. what's wrong with it?..pls
anyone know pls help me.. , looking forward for kindly help
thank you