TRADE_RETCODE_CLOSE_ONLY

 

Hey there, 

I am experiencing the error "TRADE_RETCODE_CLOSE_ONLY" with the explanatory comment " The request is rejected, because the 'Only position closing is allowed' rule is set for the symbol".

when I execute the below code on backtesting in MT5 on FDAXZ9 in period 14/10 - 15/10 2019.

However, there is no problem if I execute the same code in same period on NKDZ9.

Do you have suggestions?


#include<Trade\Trade.mqh>

CTrade trade;

void OnTick() {

        double askLongPrice = SymbolInfoDouble(_Symbol,SYMBOL_ASK);

        double ask = NormalizeDouble(askLongPrice, _Digits);

        double sl = (ask-3000*_Point);

        double tp = (ask+1500*_Point);

        double lot = 0.1;

        trade.Buy(lot, _Symbol, ask, sl, tp);

}
 
It looks like the symbol refers to a future that is about to expire. There should be a follow-up contract.
Reason: