MT4 vs MT5 ARROW disappearance

 

Greetings,

I'm writing an indicator which draws colored bullets(arrows).

int OnInit()
{
...
        SetIndexBuffer(4,BulletBuffer,INDICATOR_DATA);
   PlotIndexSetInteger(4, PLOT_SHOW_DATA, false);
   PlotIndexSetDouble(3,PLOT_EMPTY_VALUE,0.0);
   PlotIndexSetInteger(3,PLOT_DRAW_TYPE,DRAW_COLOR_ARROW);
   PlotIndexSetInteger(3,PLOT_ARROW,159);
   PlotIndexSetInteger(3,PLOT_LINE_WIDTH,3);
   PlotIndexSetInteger(3,PLOT_DRAW_BEGIN,InpSlowMAPeriod);
   PlotIndexSetString(3,PLOT_LABEL,"Signal");

   SetIndexBuffer(5,IndBulletBufferColor,INDICATOR_COLOR_INDEX);
   PlotIndexSetInteger(5, PLOT_SHOW_DATA, false);
   PlotIndexSetInteger(3,PLOT_COLOR_INDEXES,4);
   PlotIndexSetInteger(3,PLOT_LINE_COLOR,0,color1);
   PlotIndexSetInteger(3,PLOT_LINE_COLOR,1,color2);
   PlotIndexSetInteger(3,PLOT_LINE_COLOR,2,color3);
   PlotIndexSetInteger(3,PLOT_LINE_COLOR,3,color4);
...
}


int OnCalculate(...)
{
...
        int start=prev_calculated-1;
        if(start<1) start=0;

        for(int i=start; i<rates_total-1; i++)
        {
                BulletBuffer[i]=_ZERO;

                if (BufferOne[i]>_ZERO)
                {
                   if (BufferOne[i]>BufferTwo[i])
                   {
                          DrawBullets(FlagOne,FlagTwo,FlagThree,FlagFour,BufferOne[i],S_One, time[i], i);
                   }
                   else if(BufferOne[i]<=BufferTwo[i])
                   {
                          DrawBullets(FlagOne,FlagTwo,FlagThree,FlagFour,BufferOne[i],S_Two, time[i], i);
                   }
                }//if bf1>bf2
                else
                {
                   if (BufferOne[i]>BufferTwo[i])
                   {
                          DrawBullets(FlagOne,FlagTwo,FlagThree,FlagFour,BufferOne[i],S_Three, time[i], i);
                   }
                   else if(BufferOne[i]<=BufferTwo[i])
                   {
                          DrawBullets(FlagOne,FlagTwo,FlagThree,FlagFour,BufferOne[i],S_Four, time[i], i);
                   }
                }//else bf2>bf1
        }//for
...
}//OnCalculate


void DrawBullets(bool isFone,bool isFtwo,bool isFthree,bool isFfour,
            double value, ENUM_S_TYPE type, datetime time, int shift)
{
   switch(type)
   {
      case S_Three:
         if(!isFone)
         {
            FlagOne=true;
            FlagTwo=true;
            FlagThree=false;
            FlagFour=false;
            BulletBuffer[shift]=value;
            IndBulletBufferColor[shift]=0;
         }
         break;
      case S_One:
         if(!isFtwo)
         {
            FlagOne=true;
            FlagTwo=true;
            FlagThree=false;
            FlagFour=false;
            BulletBuffer[shift]=value;
            IndBulletBufferColor[shift]=2;
         }
         break;
      case S_Two:
         if(!isFthree)
         {
            FlagOne=false;
            FlagTwo=false;
            FlagThree=true;
            FlagFour=true;
            BulletBuffer[shift]=value;
            IndBulletBufferColor[shift]=1;
         }
         break;
      case S_Four:
         if(!isFfour)
         {
            FlagOne=false;
            FlagTwo=false;
            FlagThree=true;
            FlagFour=true;
            BulletBuffer[shift]=value;
            IndBulletBufferColor[shift]=3;
         }
         break;
   }//switch
}//DrawBullets

Sometimes after a period of time the bullets disappear.

I debugged the bullet buffer after the disappearance and the buffer was correct, with correct values on correct indexes.
After the
disappearance the next bullets are shown until they disappear as well.

The same approach is used on MQL4 code for MT4 and the indicator works fine.

Is something wrong with MT5 rendering which has to be configured?

What am I missing?

 

Nobody can help you without a full code.

There is nothing wrong with MT5, the problem is in your code.