Can anyone support(suggest) me to solve the strange issue?

Back to topics list To post a new topic, please log in or register
avatar
273
sheriffonline 2015.10.22 16:16
 

I would like to close my order partially 50% of lot size when it is in +20 pips.

so when order is >20 pips i tried following code:

int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
double lots = 0;
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber)
{
    continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
    if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
    {
        lots = OrderLots()*Lots/100;
        lots=NormalizeDouble(lots, NDigits);
         if (lots < MarketInfo(Symbol(), MODE_MINLOT))    // make sure lot is not smaller than allowed value
            lots = MarketInfo(Symbol(), MODE_MINLOT);
        bool ret = OrderClose(OrderTicket(), lots, OrderClosePrice(), 4, blue);
        if (ret == false)
        Print("OrderClose() error - ", ErrorDescription(GetLastError()));

    }
}
return;


but due to high impact news time like ECB,FOMC minutes EA not closing the partial order when +20 pips. what could be the issue?

is there any idea to rewrite my code to close the order till it executes?

Your help is appreciated. Thanks



avatar
2017
gooly 2015.10.22 21:42 #
 
sheriffonline:

I would like to close my order partially 50% of lot size when it is in +20 pips.

so when order is >20 pips i tried following code:

but due to high impact news time like ECB,FOMC minutes EA not closing the partial order when +20 pips. what could be the issue?

is there any idea to rewrite my code to close the order till it executes?

Your help is appreciated. Thanks

At the moments of "high impact news time" the banks or hedge funds or .. from which your broker gets the quotes you see stop providing new quotes.
Back to topics list  

To add comments, please log in or register