Show only the last counting arrow

 

Hi, unfortunately I'm not a programmer and I have this indicator where it inserts an arrow each time there are 4 consecutive candles, but I would like the indicator to only display the last counting arrow. It's possible? Thank you

#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 DarkOrange
#property indicator_width1 1
#property indicator_width2 1

extern int Consecutive_Bulls = 4; // How many consecutive Bulls
extern int Consecutive_Bears = 4; // How many consecutive Bears
extern int ArrowDistance = 5;

extern bool SoundAlert=false; // Do you want to Sound Alert?

double downArrow[];
double upArrow[];
int PipFactor = 1;
int Bull_count = 0;
int Bear_count = 0;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
//--- indicator buffers mapping
   SetIndexBuffer(0,downArrow);
   SetIndexArrow (0,234);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexLabel(0,"Consecutive Bear Candles" );
//----
   SetIndexBuffer(1,upArrow);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow (1,233);
   SetIndexLabel(1,"Consecutive BULL Candles" );
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---

   int counted_bars=IndicatorCounted();
   int limit =Bars-counted_bars;
   for(int i = 1;i<limit;i++){
   
//--- Check for BULL Candle
      if (Close[i+1]>=Open[i+1]){
         Bull_count +=1;                                             // increment Bull Candle count
         if(Bull_count >= Consecutive_Bulls){
            //upArrow[i-Consecutive_Bulls+2] = Low[i-Consecutive_Bulls+2];
            upArrow[i-Consecutive_Bulls+2] = Low[i-Consecutive_Bulls+2] - (ArrowDistance * Point * PipFactor);                                 // put Up Arrow on chart
            if(SoundAlert)Alert(Symbol()," ", Bull_count , " Consecutive BULL Candles" );
          }//end if
         }
      else Bull_count = 0;                                           // if Bear candle then reset Bull candle count

//--- Check for BULL Candle
      if (Close[i+1]<=Open[i+1]){
         Bear_count +=1;                                             // increment Bear Candle count
         if(Bear_count >= Consecutive_Bears){
            //downArrow[i-Consecutive_Bears+2] = High[i-Consecutive_Bears+2]; 
            downArrow[i-Consecutive_Bears+2] = High[i-Consecutive_Bears+2] + (ArrowDistance * Point * PipFactor);                             // put Down Arrow on chart
            if(SoundAlert)Alert(Symbol()," ", Bear_count , " Consecutive Bear Candles" );
          }//end if
         }
      else Bear_count = 0;                                           // if Bear candle then reset Bull candle count
   
   }// end for


//--- return value of prev_calculated for next call
   return(rates_total);
  }
  
int deinit()
//---- Remove all objects from screen.
   {
   ObjectDelete("upArrow");
   ObjectDelete("downArrow");
   
      return(0);

   }
//+------------------------------------------------------------------+
 
padikison: , unfortunately I'm not a programmer ... It's possible?
  1. Of course it's possible.
  2. You have only four choices: We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
              No free help
              urgent help.