there's more then a way to code it , but here is one :
you should set this variabile:
double MyOrderOpenPrice()
{
double opPrice= 0;
for( i=OrdersTotal()-1; i>=0;i--){
if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()== magic){
opPrice=OrderOpenPrice();
break;
}
}
return(opPrice);
}
and then add this to your buy or sell condition:
if(Ask>= MyOrderOpenPrice())
or
if(Bid<=MyOrderOpenPrice())
but as I said , there's more options to do that
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
Thanks