New to coding. EA Runs in Tester but no orders are opened. HELP PLEASE!

 

Hello,

 

I started coding an EA which is supposed to identify the the highs and lows over a given number of bars (Period_High_Low) and then open a sell order at the same level as the High (double-top) if the RSI conditions are met. So, if the current price touches the previous high, and the RSI of the current candle is less than the RSI of the previous candle, a sell should open. This is my first EA and not sure what I did wrong. Thanks 

extern bool     UseMoneyManagment=true;

extern double   Lot_size       = 0.1;

extern double   Risk           = 10; 

extern bool     Use_TP_SL        =true;

extern double   Take_Profit      = 200;

extern double   Stop_loss        = 200;

extern bool     Use_Trailing     = true;

extern int      TrailingStop     = 50;

extern int      TrailingStep     = 20;

input ENUM_TIMEFRAMES  TimeFrame=0;

input ENUM_APPLIED_PRICE AppliedPrice = 0;

extern int Bars_Shift = 0;

extern int RSI = 7;

extern int RSI_High = 80;

extern int RSI_Low = 20;

extern int RSI_Differential = 3;

extern int Period_High_Low = 5;

extern int Magic_Number = 012358;

double pt;

double lt;


//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  { if (Digits == 3 || Digits == 5) pt = 10; else pt=1;

//---

   

//---

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//---

   

  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {

//---


   if( UseMoneyManagment==true)

   {

     lt= (AccountEquity()/ Risk)/(Stop_loss/10);

   }

    if( UseMoneyManagment==false)

   {

     lt= Lot_size;

   }

   

  }

//+------------------------------------------------------------------+

//| ChartEvent function                                              |

//+------------------------------------------------------------------+

int start()

              

 {

//----

   

   int Highest_Bar =iHighest(NULL,TimeFrame,MODE_CLOSE,Period_High_Low,Bars_Shift);

   int Lowest_Bar = iLowest(NULL,TimeFrame,MODE_CLOSE,Period_High_Low,Bars_Shift);

   

   double RSI1= iRSI(NULL,TimeFrame,RSI,PRICE_CLOSE,Highest_Bar);

    double RSI2= iRSI(NULL,TimeFrame,RSI,PRICE_CLOSE,Bars_Shift);

     double RSI3= iRSI(NULL,TimeFrame,RSI,PRICE_CLOSE,Lowest_Bar);

      double CurrentPrice = iMA(NULL,TimeFrame,1,0,0,PRICE_CLOSE,0);

   double high = iHigh(NULL,TimeFrame,Highest_Bar);

   double low = iLow(NULL, TimeFrame, Lowest_Bar);

    

   

   

   

   if(RSI2<RSI1 && high==CurrentPrice && RSI1>RSI_High) 

      if(OrdersTotal()==0)

         int result=OrderSend(Symbol(),OP_SELL,lt,Ask,3,Ask-(Stop_loss),Ask+(Take_Profit),NULL,Magic_Number,0,Red);

   




//----

   return(0);

  }

   

  //+------------------------------------------------------------------+
Reason: