mediate the price - page 2

 
Giovanni Guastella:
void Cross()
{
  double PreviousChipmunk = iMA (Symbol(),0,Cperiod,Cscostamento,Cmetodo,Capplica,2);
  double Chipmunk = iMA (Symbol(),0,Cperiod,Cscostamento,Cmetodo,Capplica,1);
  double PreviousTurtle = iMA (Symbol(),0,Tperiod,Tscostamento,Tmetodo,Tapplica,2);
  double Turtle = iMA (Symbol(),0,Tperiod,Tscostamento,Tmetodo,Tapplica,1);

   if (PreviousChipmunk<PreviousTurtle && Chipmunk>Turtle)
   {
    if (OrdersTotal()==0 )
      ticket=(OrderSend (Symbol(),OP_BUY,Lotto,Ask,3,0,Ask+(TakeProfit*Point),"buy",1234,0,clrGreen));
      }
  
    if (OrdersTotal()==1)
   {
   OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES);
   if( OrderOpenPrice() > 200*Point) {
   ticket2=(OrderSend (Symbol(),OP_BUY,Lotto,Ask,3,0,Ask+(TakeProfit*Point),"buy 2",12345,0,clrGreen));
     }
}

// in this way does not work ... I can not find an example that can help me (of course we all understand that I'm a newbie on mql :))
// maybe i will do a bool?  loss=(OrderOpenPrice() - OrderClosePrice())?
// i have need him open the trade after 200  pips down, but not work fine

Of course not! There are many problems, but the main one is that you did not even do what I told you to do. Did I not say:

compare the "OrderOpenPrice()" with the current market price "OrderClosePrice()"

As for the rest, your level of knowledge on MQL or even "trading" is not sufficient for us to be able to communicate to you what needs to be done.

So, I suggest you spend at least a few weeks (maybe months) dedicating yourself to properly read all the documentation, and examples and samples in the CodeBase to be able to improve your coding skills so you can understand how MetaTrader and MQL works ...

... or, alternatively, if you don't have the time nor are able to apply yourself to that task, then hire someone to do it for you!

 

   if( OrderOpenPrice() > 200*Point)

should be


   if( OrderOpenPrice()-OrderClosePrice() > 200*Point)


.
 
Keith Watford:

   if( OrderOpenPrice() > 200*Point)

should be


   if( OrderOpenPrice()-OrderClosePrice() > 200*Point)


.
it worked fine! Thank you!!! 

I had done well but since it seemed to me that the warning was not boolean, then I have not even tried.

Thank you so much. You've been a real help.
Reason: