My simple EA does not enter in the market

 

Hi everyone,


Sorry to bother you for that but I am a beginner and I do not understand why my EA doe not work. I mean that the code is working but when I do a back-test, it seems that the EA doesn't enter in the market.


Could you maybe help me?


Best regards.


Stefan Hanssen

BacktestCode 

 

Hello try this

   double ask=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
   bool check=order.Buy(0.1,Symbol(),ask,0,0,NULL);
   ulong ticket=order.ResultOrder();
   Print("Order Ticket : "+ticket);
   //change stops 
   double sl=ask-500*Point();
   double tp=ask+1000*Point();
   bool modi=order.PositionModify(ticket,sl,tp);   
 
Lorentzos Roussos:

Hello try this

Thank you so much for your answer... I just have a simple problem. When I compile the code there is an error


: 'order' - undeclared identifier SimpleBuyTrade.mq5 7 15


Do you know what is the problem?


 
ow sorry . Change the CTrade trade to CTrade order . 
My mistake :)
 
Thank you so much for your help. It's working now