Download MetaTrader 5
To add comments, please log in or register
Interested in traders' opinion? Arrange a poll on the Forum!
fxewen
99
fxewen 2014.03.10 07:22 

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);
  }
Keith Watford
Moderator
7887
Keith Watford 2014.03.10 07:31  
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) 
Tjipke de Vries
6275
Tjipke de Vries 2014.03.10 07:38  
int OnInit()
  {
unbelievable the first tick will be that (Ask == Price)
/
To add comments, please log in or register