Try
bool IsPositionBuy(int Level) { int totalorders = OrdersTotal(); for(int i=0;i<totalorders;i++) // scan all positions { if (!OrderSelect(i, SELECT_BY_POS)) continue; if ( OrderType() == OP_BUY && OrderMagicNumber()==Level ) return(true); } return(false); }
I tried it, didn't help. It seems the ea just opens duplicate trades within the same bar. is there a way to avoid it?
Show your code...
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
is there any case this shouldn't work that i didn't think of? i'm getting multiple trades at the same level, so i believe the problem is in this code section. help is much appreciated..
bool IsPositionBuy(int Level)
{
int totalorders = OrdersTotal();
for(int i=0;i<totalorders;i++) // scan all positions
{
OrderSelect(i, SELECT_BY_POS);
if ( OrderType() == OP_BUY && OrderMagicNumber()==Level ) return(true);
}
return(false);
}