Help me port a simple indicator to MT5 please? - page 2

To add comments, please log in or register
jakubdonovan36
244
jakubdonovan36  
Mladen Rakic:

Believe me - they are (not just the colors, but the style and the line thickness too) :

No idea whatsoever what are you doing, but that is the simplest indicator of them all - there is no limit that would prevent it from changing colors

Use the indicator from my post - do not try to change the code - and then you shall have no problems at all

I see. It must be an issue with my installation of MT5. I have reinstalled it and the issue persists. Il see if i can fix it. Thanks
jakubdonovan36
244
jakubdonovan36  
Mladen Rakic:

Use this then :

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   2
#property indicator_label1  "Daily high line"
#property indicator_type1   DRAW_LINE
#property indicator_style1  STYLE_DOT
#property indicator_color1  clrDodgerBlue
#property indicator_label2  "Daily low line"
#property indicator_type2   DRAW_LINE
#property indicator_style2  STYLE_DOT
#property indicator_color2  clrSandyBrown

double highLine[],lowLine[];

int OnInit()
{
   SetIndexBuffer(0,highLine,INDICATOR_DATA);
   SetIndexBuffer(1,lowLine ,INDICATOR_DATA);
   return(INIT_SUCCEEDED);
}
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[])
{
   if (Bars(_Symbol,_Period)<rates_total) return(0);
   int i=0;
      for (i=(int)MathMax(prev_calculated-1,0); i<rates_total && !_StopFlag; i++)
      {
         MqlRates rates[]; if (CopyRates(_Symbol,PERIOD_D1,time[i],2,rates)==-1) break;
            highLine[i] = rates[0].high;
            lowLine[i]  = rates[0].low;
      }
      return(i);
}

Hello. I figured it out.  Do you think that you can tell me how i can make the indicator show "YH" and "YL" on the most recent period like in this pic?  https://i.gyazo.com/cee24e278faeb4d2cd0257bb190e4d85.png

Files:
yh.png 34 kb
12
To add comments, please log in or register