Forum

OrderDelete() Error 4108 for Closing Pending Orders

I have an EA running that has the potential to open a new pending order with each new candle that gets created. I'm now trying to delete the oldest pending order that was created so that each currency only has one pending order at a time. However, I'm getting error 4108 when calling OrderDelete()

OrderClose Error 138

I have an EA that opens BUY and SELL orders with a stoploss and takeprofit based on certain conditions. However, when the moving average turns positive or negative over a certain number of bars , I want to close the order. When I do this, I keep getting error code 138 on the OrderClose. Does anyone