santoshh,
your function call seems to be correct. I tried to compile exactly same line by myself it worked. Only issue you may have is that OrderTicket(),OrderLots() return invalid parameter. You have to use such functions after OrderSElect.
Example:
for (i=0;i<OrdersTotal();i++)
{
if (OrderSelect(i,SELECT_BY_POS))
{
if (OrderMagicNumber()==MYMAGIC)
{
regards
bool OrderClose( | int ticket, double lots, double price, int slippage, color Color=CLR_NONE) |
ticket | - | Unique number of the order ticket. |
lots | - | Number of lots. |
price | - | Preferred closing price. |
slippage | - | Value of the maximum price slippage in points. |
Color | - | Color of the closing arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart. |
Either you're missing an orderSelect, the order is a sell (close at the ask,) or you haven't adjust slippage (15) for 5 digit broker.
NormalizeDouble(MarketInfo(OrderSymbol(), MODE_BID),5) is unnecessary, Bid/Ask is Always normallized and correct as is.
For closing you can also always use OrderClosePrice() for either direction.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I am getting Invalid Function Parameter Value at below line in my EA.
OrderClose( OrderTicket(), OrderLots(), NormalizeDouble(MarketInfo(OrderSymbol(), MODE_BID),5), 15, CLR_NONE );
Can somebody highlight the problem in above statement. thanks in advance.