Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 434
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
I can't figure out why my orders are not closing and the log shows error 4051 "invalid ticket for OrderClose function".
if (Total>0)
{for(cnt=0;cnt<Total;cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
{
if (OrderType() == OP_BUY)
{
if(a<b)
{
OrderClose(cnt,1,Bid,3,Red);
return(0);
}
}
else
{
if(a>b)
{
OrderClose(cnt,1,Ask,3,Red);
return(0);
}
}
}
}
}
I can't figure out why my orders aren't closing and the log shows error 4051 "invalid ticket for OrderClose function".
for(cnt=Total-1;cnt>=0;cnt--)
IMHO else is unnecessary there, and I don't have to put any returnees...
Oh, and it wouldn't hurt to clearly specify position type for sales too, they can be not only buy and sell.
I can't figure out why I don't close orders, and the log shows error 4051 "invalid ticket for OrderClose function".
not
OrderClose(cnt,...)
а
OrderClose(OrderTicket(),...)
How can I insert the slope of a moving average into an EA, for example I am interested in the trend if the slope is more than 20 degrees?
By the time a trend is formed on the MA, the market has already started a flat)))
How can I insert the slope of a moving average into an EA, for example I am interested in the trend if the slope is more than 20 degrees?
So it will only give you the opportunity to perform an action in time, not when the tick comes, as I understand it, and I need to put the owl to sleep in the tester after the condition...
And how can I insert into an EA the slope of a moving average e.g. I am interested in the trend if the slope is more than 20 degrees?
Can I write variable values to an array in this way?