I keep getting error 4753 when using cTrade.PositionOpen

I am trying to run an EA from a tutorial, but I keep getting errorcode 4753

I tried with a demo account from a broker and also a standard mt5 demo account…

Please help


Files: Anna_v1.02_Complete.mq5 12 KB

You mean 4753 I suppose ?

Sorry, yes, the code in the title is the correct one, I am editing to fix the other one


Is the position open or not ?

The code is not correct. It should be something like :slight_smile:

if(myTradingControlPanel.PositionOpen(_Symbol, ORDER_TYPE_BUY, lot, currentAsk, stopLossLevel, takeProfitLevel, ...)
  && (myTradingControlPanel.ResultRetcode()==10008 || myTradingControlPanel.ResultRetcode()==10009) 
    Print("Entry rules: A Buy order has been successfully placed with Ticket#: ", myTradingControlPanel.ResultOrder());
    Print("Entry rules: The Buy order request could not be completed. Error: ", GetLastError(), myTradingControlPanel.ResultRetcode());

I’m not experienced with MQL, but that part of the code is inside this if(PositionSelect(_Symbol) == false) so no, I guess it is not opened.

I noticed that ResultRetcode returned errorcode 10030, so I found out that I needed to put this inside OnInit


now my EA is trading! thanks