ancorp:
Dear all,
Dear all,
im using mt4 and i would like to know how to open trade (sellstop or buy stop) if only buy or sell active ?
if( OrdersTotal() only have 1 (one) open buy or open sell)
{
OpenTrades();
}
if 1 open buy active, will open sell stop or
if 1 open sell active, will open buy stop
Thanks in advance for any help.
AncorpYou can do something similar to this :
int start()
{
if (OrdersTotal()==1 && isOpened(OP_SELLSTOP)) // code to open buy stop
if (OrdersTotal()==1 && isOpened(OP_BUYSTOP)) // code to open sell stop
return(0);
}
bool isOpened(int type)
{
for (int i=OrdersTotal()-1; i>= 0; i--)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if (OrderType()==type)
return(true);
}
return(false);
}

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
Dear all,
im using mt4 and i would like to know how to open trade (sellstop or buy stop) if only buy or sell active ?
if( OrdersTotal() only have 1 (one) open buy or open sell)
{
OpenTrades();
}
if 1 open buy active, will open sell stop or
if 1 open sell active, will open buy stop
Thanks in advance for any help.
Ancorp