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

thanks
Files:
 
badjano:
I am trying to run an EA from a tutorial, but I keep getting errorcode 4573

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

Please help

thanks
You mean 4753 I suppose ?
 
Alain Verleyen:
You mean 4753 I suppose ?

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

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

Ok.

Is the position open or not ?

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

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());
  }
else
  {
    Print("Entry rules: The Buy order request could not be completed. Error: ", GetLastError(), myTradingControlPanel.ResultRetcode());
    ResetLastError();
    return;
  }
         
 
Alain Verleyen:

Ok.

Is the position open or not ?

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


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.
 
Alain Verleyen:

Ok.

Is the position open or not ?

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


I will make those changes to my code when I get home, and I'll let you know if anything new happens
 
Alain Verleyen:

Ok.

Is the position open or not ?

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


I just changed as you suggested, it still keeps saying error 4753
 
Alain Verleyen:

Ok.

Is the position open or not ?

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


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

  myTradingControlPanel.SetTypeFilling(ORDER_FILLING_IOC); 

now my EA is trading! thanks