Open order each Candlestick closure ?

 

I've done with a lot of difficulties (I'm completely a beginner) the following code, but the order is opening every tick (I've used MqlTick).

Is there a possibility to use another command to check every candlsestick closure ?

Thanks


_________________________________________________________________________________________________________

   //Open Buy Order

   if(RSI_Scalping_1[0] != 0 && RSI_Scalping_1[0] != EMPTY_VALUE //RSI_Scalping is not equal to fixed value

   )

     {

      MqlTick last_tick;

      SymbolInfoTick(Symbol(), last_tick);

      price = last_tick.ask;

      SL = 8 * myPoint; //Stop Loss = value in points (relative to price)

      if(!inTimeInterval(TimeCurrent(), TOD_From_Hour, TOD_From_Min, TOD_To_Hour, TOD_To_Min)) return; //open trades only at specific times of the day

      if(!TradeDayOfWeek()) return; //open trades only on specific days of the week   

      if(TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) && MQLInfoInteger(MQL_TRADE_ALLOWED))

        {

         ticket = myOrderSend(ORDER_TYPE_BUY, price, TradeSize, "");

         if(ticket == 0) return;

        }

      else //not autotrading => only send alert

         myAlert("order", "");

      myOrderModifyRel(ORDER_TYPE_BUY, ticket, SL, 0);

     }

________________________________________________________________________________________________________________

Reason: