please help me to add BULLISH/BEARISH Bar counter code

To add comments, please log in or register
Nguyen5
13
Nguyen5  
BULLISH/BEARISH Bar counter code


Hi guys i`m having problem creating a bar counter code.Basically this indicator would be a statistical tool for me and it would help me very much with my market research.
It would count how many  BEARISH bars appear and BULLISH bars at the next candle of certain time "EST" 
for example in the photo the indicator will add only the blue lines at time "EST" and i want to add the counter of how many up/ down candles for only the next candle after the blue lines and it will show the result same in the rectangle that i have added in the photo.

i added the arrows just for explaining but i don't need the arrow.


couter


#property indicator_chart_window

extern int EST=7;
extern int CountBars=500;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   int shift=0;
   for  (shift=Bars-1;shift>=0;shift--) {
   ObjectDelete("EST"+shift);
   ObjectDelete("Broker"+shift);
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int shift, NumBars=500;
   double CloseTime,OpenTime;
   
   if (Bars<CountBars)  { NumBars=Bars-1; } else { NumBars=CountBars; }

   for  (shift=Bars-1;shift>=0;shift--) {
 
          
          
          if (TimeHour(Time[shift])== EST && TimeMinute(Time[shift])==0) {
             if(ObjectFind("EST"+shift) != 0)
         {            
            ObjectCreate("EST"+shift, OBJ_VLINE, 0, Time[shift], 0);
            ObjectSet("EST"+shift, OBJPROP_STYLE, STYLE_DASHDOTDOT);
            ObjectSet("EST"+shift, OBJPROP_COLOR, Blue);
         }           
      }
      
      
      if (TimeHour(Time[shift])== 0 && TimeMinute(Time[shift])==0) {
             if(ObjectFind("Broker"+shift) != 0)
         {            
            ObjectCreate("Broker"+shift, OBJ_VLINE, 0, Time[shift], 0);
            ObjectSet("Broker"+shift, OBJPROP_STYLE, STYLE_DASHDOTDOT);
            ObjectSet("Broker"+shift, OBJPROP_COLOR, White);
         }           
      }  

   }


   return(0);
  }
//+------------------------------------------------------------------+


Alain Verleyen
38685
Alain Verleyen  
Nguyen5:
BULLISH/BEARISH Bar counter code


Hi guys i`m having problem creating a bar counter code.Basically this indicator would be a statistical tool for me and it would help me very much with my market research.
It would count how many  BEARISH bars appear and BULLISH bars at the next candle of certain time "EST" 
for example in the photo the indicator will add only the blue lines at time "EST" and i want to add the counter of how many up/ down candles for only the next candle after the blue lines and it will show the result same in the rectangle that i have added in the photo.

i added the arrows just for explaining but i don't need the arrow.




There is not even an attempt to count the bars in your code.

Show your own attempts if you want help, don't expect someone else to do it for you.

To add comments, please log in or register