int count_BUY()
{
int count_0 = 0;
int li_4 = OrdersTotal() - 1;
for (int pos_8 = li_4; pos_8 >= 0; pos_8--)
{
if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES))
if (OrderType() == OP_BUY && OrderMagicNumber() == MagicNumber) count_0++;
}
if (count_0 >= 1) return (0);
return (1);
}
int count_SELL()
{
int count_0 = 0;
int li_4 = OrdersTotal() - 1;
for (int pos_8 = li_4; pos_8 >= 0; pos_8--)
{
if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES))
if ((OrderType() == OP_SELL && OrderMagicNumber() == MagicNumber)) count_0++;
}
if (count_0 >= 1) return (0);
return (1);
}
Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!
Thank you.
int count_BUY()
{
int count_0 = 0;
int li_4 = OrdersTotal() - 1;
for (int pos_8 = li_4; pos_8 >= 0; pos_8--)
{
if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES))
if (OrderType() == OP_BUY && OrderMagicNumber() == MagicNumber) count_0++;
}
if (count_0 >= 1) return (0);
return (1);
}
int count_SELL()
{
int count_0 = 0;
int li_4 = OrdersTotal() - 1;
for (int pos_8 = li_4; pos_8 >= 0; pos_8--)
{
if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES))
if ((OrderType() == OP_SELL && OrderMagicNumber() == MagicNumber)) count_0++;
}
if (count_0 >= 1) return (0);
return (1);
}
nice variable name :)
Dear how to count only open orders like OP_BUY and OP_SELL only. i like to compare order count and after i want to execute the program. i made the function as below.
int totalordercount()
{
int total=0;
for(int i=0;i<=OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
{
if(OrderType()==(OP_BUY||OP_SELL)) total++;
}
}
return(total);
}
i call this function for another order opening like if totalordercount()==1 than the another order open. but not succeed. kindly help regarding.
int totalordercount() { int total=0; for(int i=0;i<=OrdersTotal();i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderType() <= OP_SELL)) total++; } return(total); }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear how to count only open orders like OP_BUY and OP_SELL only. i like to compare order count and after i want to execute the program. i made the function as below.
int totalordercount()
{
int total=0;
for(int i=0;i<=OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
{
if(OrderType()==(OP_BUY||OP_SELL)) total++;
}
}
return(total);
}
i call this function for another order opening like if totalordercount()==1 than the another order open. but not succeed. kindly help regarding.