mql4 line disappearing problem

 

Hello friends. I am having problems with MQL4 indicator coding. I am not that good at programming. I am having the problems I mentioned below with the RSI indicator. Can you help me?


When I add this code after the rssi buffer, both lines disappear. It does not produce an error code. Compilation is successful but my lines are deleted.

Thank you for your help.

//+------------------------------------------------------------------+
//|                                                      RSİFİBO.mq4 |
//|                                  Copyright 2025, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2025, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//------------------------------------------------------------------
//
//------------------------------------------------------------------
#property indicator_separate_window
#property indicator_buffers 6





extern int    rsi_period   = 14; 
extern int    Price    = PRICE_CLOSE; 
extern ENUM_MA_METHOD MaMethod   = MODE_EMA; 
extern int    Price1    = PRICE_CLOSE; 
extern int    Ma_period   = 14;


double Rssi[],Rssort[],h1[],l1[];
//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//

int init() 
{
   IndicatorBuffers(5);
   SetIndexBuffer(0,Rssi);
   SetIndexStyle(0,DRAW_LINE,EMPTY,2,clrYellow); 
   SetIndexLabel(0,"RSİ");
   SetIndexBuffer(1,Rssort);
   SetIndexLabel(1,"Mean");
   SetIndexStyle(1,DRAW_LINE,EMPTY,2,clrRed); 
   
   SetIndexBuffer(2,h1);
   SetIndexLabel(2,"High");
   SetIndexStyle(2,DRAW_LINE,EMPTY,1,clrGreen);
   SetIndexBuffer(3,l1);
   SetIndexLabel(3,"Low");
   SetIndexStyle(3,DRAW_LINE,EMPTY,1,clrRed);

   return (0);
}

////
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 limit = rates_total-prev_calculated;
      if (prev_calculated>0) limit++;
    
       for(int i= limit-1; i>0; i--)
       {
     
          
           Rssi[i] = iCCI(NULL,PERIOD_CURRENT,rsi_period,Price,i);
                                           
           Rssort[i] = iMAOnArray(Rssi,0,Ma_period,0,MaMethod,i);
           
           
     
 
      }

   

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

        if(Rssi[i+1]>Rssi[i+2]){

           tplml1[i]=Rssi[i+1]-(Rssi[i+2]-Rssi[i+2]);

           }else if(Rssi[i+1]<Rssi[i+2]){

           tplm1[i]=Rssi[i+1]-(Rssi[i+2]-Rssi[i+2]);

           }else {

           tplm1[i]=Rssi[i+1]-(Rssi[i+2]-Rssi[i+2]);

           }

 
I've never seen a buffer index style set to EMPTY. I haven't tested your code, but EMPTY likely means invisible.
 
Ryan L Johnson #:
I've never seen a buffer index style set to EMPTY. I haven't tested your code, but EMPTY likely means invisible.

Even if I do it differently, the result is negative.

 
zeppi23:

           tplm1[i]=Rssi[i+1]-(Rssi[i+2]-Rssi[i+2]);

what is tplm1?

 
Yashar Seyyedin #:

what is tplm1?

I will then use tmpl1 as int highest=Arraymaximum(tmpl1,21,i) to get the maximum value.I will then use tmpl1 as int highest=Arraymaximum(tmpl1,21,i) to get the maximum value and use it as double yk1 = tmpl1[highest];

 
zeppi23 #:

I will then use tmpl1 as int highest=Arraymaximum(tmpl1,21,i) to get the maximum value.I will then use tmpl1 as int highest=Arraymaximum(tmpl1,21,i) to get the maximum value and use it as double yk1 = tmpl1[highest];

My aim here is to calculate the maximum and minimum values ​​of the tmpl1 value in the last 21 minutes according to the condition.

 

I cannot know what the problem is with restricted access to your code but two things I can guess:

  • "Indicator values exceeding Indicator window Maximum and Minimum."
  • "Some kind of bug like array out of range causing the indicator not to paint anymore."
 
Yashar Seyyedin #:

I cannot know what the problem is with restricted access to your code but two things I can guess:

  • "Indicator values exceeding Indicator window Maximum and Minimum."
  • "Some kind of bug like array out of range causing the indicator not to paint anymore."

Is there another way to do this?

 
zeppi23 #:

Is there another way to do this?

Sorry. Your purpose is ambiguous.