Pending Buy / Sell at specific price

 

external enter a price value, when price reach the value then buy/sell.

Problem: 'Ask' - constant cannot be modified

extern double Price = 1.0 ;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--
   if (Ask = Price) 
    OrderSend(Symbol(),OP_BUY,3,Ask,3,0,0,"My order #2",3,0,Red);
   
   
//---
   return(INIT_SUCCEEDED);
  }
 
FXEWEN:

external enter a price value, when price reach the value then buy/sell.

Problem: 'Ask' - constant cannot be modified



if (Ask = Price) 

//Change to
if (Ask == Price) 
 
int OnInit()
  {
unbelievable the first tick will be that (Ask == Price)
Reason: