How to fix DRAW_LINE error in Multi Time Frame indicator?

To add comments, please log in or register
Thushara Dissanayake
38171
Thushara Dissanayake  

This indicator draw multi time frame data in a separate window. When it run in 1 Minute chart, other trend lines are draw as straight lines. It only draw correctly 1 minute trend line. When i change the time frame or reload the indicator, then it redraw correctly. I know the reason for that. But i can't find good solution for it. This problem can fix using this https://www.mql5.com/en/forum/178300/page5#comment_4360132 refresh code. But it call some DLL file to do that. I do not want to call any DLL for that. Please help me to fix this problem.

 


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 shift,limit;
//----
   if(counted_bars<0) return(-1);
   if(counted_bars<1) limit=Bars-1;
   else limit=Bars-counted_bars;
   for(shift=0; shift<=limit; shift++)
     {
         
         if(m1)RSIM1[shift]=iRSI(NULL,PERIOD_M1,RSI_AveragingPeriod,ENUM_APPLIED_PRICE(RSI_AppliedPrice),shift);
         if(m5)RSIM5[shift]=iRSI(NULL,PERIOD_M5,RSI_AveragingPeriod,ENUM_APPLIED_PRICE(RSI_AppliedPrice),shift);
         if(m15)RSIM15[shift]=iRSI(NULL,PERIOD_M15,RSI_AveragingPeriod,ENUM_APPLIED_PRICE(RSI_AppliedPrice),shift);
         if(m30)RSIM30[shift]=iRSI(NULL,PERIOD_M30,RSI_AveragingPeriod,ENUM_APPLIED_PRICE(RSI_AppliedPrice),shift);
         if(h1)RSIH1[shift]=iRSI(NULL,PERIOD_H1,RSI_AveragingPeriod,ENUM_APPLIED_PRICE(RSI_AppliedPrice),shift);
         if(h4)RSIH4[shift]=iRSI(NULL,PERIOD_H4,RSI_AveragingPeriod,ENUM_APPLIED_PRICE(RSI_AppliedPrice),shift);
         if(d1)RSID1[shift]=iRSI(NULL,PERIOD_D1,RSI_AveragingPeriod,ENUM_APPLIED_PRICE(RSI_AppliedPrice),shift);
         if(w1)RSIW1[shift]=iRSI(NULL,PERIOD_W1,RSI_AveragingPeriod,ENUM_APPLIED_PRICE(RSI_AppliedPrice),shift);
         if(mn)RSIMN[shift]=iRSI(NULL,PERIOD_MN1,RSI_AveragingPeriod,ENUM_APPLIED_PRICE(RSI_AppliedPrice),shift);
        
     }

//---
   return(rates_total);
  }

When i change the chart time frame then it redraw correctly.


William Roeder
19633
William Roeder  
… [shift]=iRSI(NULL,PERIOD_M1,RSI_AveragingPeriod,ENUM_APPLIED_PRICE(RSI_AppliedPrice),shift);
You are mixing apples and oranges.
To add comments, please log in or register