[ASK] any operators that have constant value untill we change or reset it?

To add comments, please log in or register
Yosafat Supono
340
Yosafat Supono  

Please help, I want to make reversal order,

      double Op = iOpen(Symbol(),0,0);
      double Cl = iClose(Symbol(),0,0);
      double Lowest = iLow(Symbol(),0,0);
      double Highest = iHigh(Symbol(),0,0);

                                 if(OrdersTotal()==0 && Ask > Lowest+(10*pt)  )
                                   {
                                   int buy1=OrderSend(Symbol(),OP_BUY,BasicLot,Ask,3,0,0,"BUY1",LuckNumber,0,Blue);
                                 
                                  return(0);
                                   }
                                                   // {       
                                 if(OrdersTotal()==0 && Bid < Highest-(10*pt)  )
                                   {
                                   int sell1=OrderSend(Symbol(),OP_SELL,BasicLot,Bid,3,0,0,"SELL1",LuckNumber,0,Red);
                                   
                                  return(0);
                                   }

after one order already execute and closed, this EA still make order when the price hitted

Ask > Lowest+(10*pt) or Bid < Highest-(10*pt)

what should I do to make sure the price is moving from below to buy order and from top for sell order?

any Operators that have constant value untill we change or reset it?


Thank you for Help

Konstantin Nikitin
7909
Konstantin Nikitin  
iMA will show the direction
William Roeder
20233
William Roeder  

Yohsafat S:

what should I do to make sure the price is moving from below to buy order and from top for sell order?

any Operators that have constant value untill we change or reset it?

  1. Compare the last value to the current. Remember the latest value for the next tick. Or, compare bar 2 close vs. bar 1 close.
  2. That's called a static (or globally declared) variable.
To add comments, please log in or register