how to code EA to close trade on Close Candle.

 

Hi,

can you please advise me how to encode the EA to close the positioned close candle?

I want to use EA for RENKO, so EA will not count the TimeFrame.

Thank you

void TechnicalAnalysis4()
{
     if ( (Hour()==23 && Minute()<2) || ( CloseCan==Ano && iTime(NULL,PERIOD_CURRENT, current+1) > OrderOpenTime()) && OrdersTotal() > 0 && OrderType() == OP_BUY)  
      
    {
        CloseAll10();
        
    }
}

void CloseAll10()
{
    int orderstotal = OrdersTotal();
    int orders = 0;
    int ordticket[90][2];
    for (int i = 0; i < orderstotal; i++)
    {
        bool sel = OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
        if (OrderType() != OP_BUY || OrderSymbol() != Symbol())
        {
            continue;

 
Jiri Kasparek:

Hi,

can you please advise me how to encode the EA to close the positioned close candle?

I want to use EA for RENKO, so EA will not count the TimeFrame.

Thank you

is this the full code?? because there is no "OrderClose" function in your code above.