Download MetaTrader 5

I need your support on this new indicator please

To add comments, please log in or register
kapoo
37
kapoo  

i have been baffling with the alert when on the current candle , that is i want it to be given immediately the arrow show on current candle.

Have worked on the arrow to be showing on current candle when conditions are met  by changing the array to 0 (zero) in other be reading current candle.

 if (signalchecking[0] < Osold) signalup[i] = Low[i] - itr_space / 2.0;

      if (signalchecking[0] > Obought) signaldown[i] = High[i] + itr_space / 2.0;


And here is what i also did for alert immediately the arrow shows on current candle but is not working , it only alert after the closure of the current candle that shows arrow.

   if ( signalup[0] != 0.0 && Open[0] == Low[0] && Open[0] == High[0] && Open[0] == Close[0]) Alert(Symbol(),"  Signal  UP");

   if ( signaldown[0] != 0.0 && Open[0] == Low[0] && Open[0] == High[0] && Open[0] == Close[0]) Alert(Symbol()," Signal  DOWN");


Below is the whole codes

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 LimeGreen
#property indicator_color2 Red
#property indicator_color3 Red

int Obought = 65;
int Osold = 25;
extern bool Alert = TRUE;
double signalup[];
double signaldown[];


int init() {
   
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexArrow(0, 225);
   SetIndexBuffer(0, signalup);
   SetIndexEmptyValue(0, 0.0);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 226);
   SetIndexBuffer(1, signaldown);
   SetIndexEmptyValue(1, 0.0);
   return (0);
}

int start() {

   double signalchecking[2];  
   double itr_space = iATR(Symbol(), 0, 50, 1);
   for (int i = 0; i < Bars; i++) {
      signalup[i] = 0.0;
      signaldown[i] = 0.0;
      for (int d = 0; d < 2; d++) signalchecking[d] = iRSI(Symbol(), 0, BSperiod, PRICE_CLOSE, i + d);
      if (signalchecking[0] && signalchecking[d]>0 && > Osold) signalup[i] = Low[i] - itr_space / 2.0;
      if (signalchecking[d]> 0 && signalchecking[0]>0 && < Obought) signaldown[i] = High[i] + itr_space / 2.0;
   }
   if ( signalup[0] != 0.0 && Open[0] == Low[0] && Open[0] == High[0] && Open[0] == Close[0]) Alert(Symbol()," Signal UP");
   if ( signaldown[0] != 0.0 && Open[0] == Low[0] && Open[0] == High[0] && Open[0] == Close[0]) Alert(Symbol(),"Signal DOWN");
   return (0);
}
whroeder1
15722
whroeder1  
kapoo: it only alert after the closure of the current candle that shows arrow.
Open[0] == Low[0] && Open[0] == High[0] && Open[0] == Close[0]
When can open equal the low and the high and the close at the same time?
kapoo
37
kapoo  
whroeder1:
When can open equal the low and the high and the close at the same time?

was trying to stop the repetition  of alert , because  have tried it like the below codes before, and it use to alert once the arrow comes out but alert use to got repeated on every tick until the candle close.

 if ( signalup[0] != 0.0 ) Alert(Symbol()," Signal UP");
   if ( signaldown[0] != 0.0 ) Alert(Symbol(),"Signal DOWN");
To add comments, please log in or register