
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
The below code is meant to delete, for a specific symbol, a pending buystop order if the bid is less than open[0] or a sellstop order if the ask is greater than open[0]
It does not work :(
Anybody have an idea what is wrong .... Thanks
total=OrdersTotal();
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELLSTOP &&
OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUYSTOP)
{
if( Bid <= Open[0] )
OrderDelete( OrderTicket() );
return(0);
}
total=OrdersTotal();
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELLSTOP &&
OrderSymbol()==Symbol())
{
if(OrderType()==OP_SELLSTOP)
{
if( Ask >= Open[0] )
{
OrderDelete( OrderTicket() );
return(0);
}
}
}
}
}