
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
Hi all
i need a little help with this part of a code
At the moment with this code my ea opens maximum two orders each time but the problem is that if there is a second order it could be either a second buy or a second sell and i only need it to be able to open one sell and one buy .I'm not a programmer so please answer me as simple as possible
bool TradeNotPlacedYet()
{
int total = OrdersTotal();
if (total > 1)
{
for(int cnt=total-1;cnt>=0;cnt--)
{
if(OrderSelect(cnt,SELECT_BY_POS))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber)
{
return (false);
}
}
}
}
int histotal = OrdersHistoryTotal();
if (histotal > 1)
{
for(cnt=histotal-1;cnt>=0;cnt--)
{
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber)
{
if (OrderOpenTime() >= Time[0])
{
return (false);
}
}
}
}
}
return (true);
}