Need Help With Code! Global Expression Error for simple code

 

Need help with the code below,


its a simple code meant to be optimized but i cant make it work. Please help!!!!


Thanks

Daen

//+------------------------------------------------------------------+
//|                                            Buy Low Sell high.mq4 |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#define MAGICMA  3939
//---- input parameters
extern double Range=4;
extern double MA=20;
extern double stop_loss=400;
extern double lotsize=1;
extern string Comment_8           = " -- On init delete all pending orders";
extern bool InitResetOrders       = true;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----

int i;
double HighestPrice = iHigh(NULL,PERIOD_H1,Range);
double LowestPrice = iLow(NULL,PERIOD_H1,Range);
double MAPrice;
MAPrice = iMA(NULL,PERIOD_H1,0,MODE_SMA,PRICE_CLOSE,1);


//Order Management

if(InitResetOrders)
   {
      int    Pos;
      int    Total=OrdersTotal();
   
      if(Total>0)
      {for(i=Total-1; i>=0; i--) 
        {
         if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == TRUE) 
          {
            
               continue;
            }//if
 
               Pos=OrderType();
               if((Pos==OP_BUYSTOP)||(Pos==OP_SELLSTOP)||(Pos==OP_BUYLIMIT)||(Pos==OP_SELLLIMIT)){OrderDelete(OrderTicket(), CLR_NONE);}
   //-----------------------
               //-----------------------
 
          }//if
        }//for
    
   
   }
}


//Buy
   if (Ask > MAPrice){
   if (OrdersTotal() == 0){
         OrderSend(Symbol(), OP_BUYLIMIT, lotsize ,LowestPrice, 3, Ask - stop_loss * Point, HighestPrice, 0, 0, 0, Blue);
  }
  }
  if (MAPrice > Ask){
     if (OrdersTotal() == 0){
         OrderSend(Symbol(), OP_SELLLIMIT, lotsize ,LowestPrice, 3, Ask - stop_loss * Point, HighestPrice, 0, 0, 0, Blue );
  }
  }
//----
   return(0);
  }
//+------------------------------------------------------------------+
 

Impossible to place

OrderSend(Symbol(), OP_SELLLIMIT, lotsize ,LowestPrice......
Do you know why ????
 

Sorry, I am noob. I dunno why.

 
daentay:

Sorry, I am noob. I dunno why.


what is the lowestprice

it is the low of candel 4 1H timeframe of your symbol

and you make that the entry for your SELLLimit trade

will that be valid to do ??

 

What is this meant to do ?

if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == TRUE) 
          {
            
               continue;   // <-----  why ?
            }//if

continue "A continue operator gives control to the beginning of the nearest outward cycle while or for operator, the next iteration being called. The purpose of this operator is opposite to that of break operator."