Indicator Lücke

 

Hallo,


hab da mal ein Problem mit einem Indictor.

hab mir einen Indicator von mladen "ausgeborgt". Hier zu finden

https://www.mql5.com/en/code/25257

nachdem mir die ColorIndex nicht gefallen, weil die kann man ja nicht auslesen, hab ich mir den soweit umgebaut, das ich statt einem Colorindex jetzt 2 Index drin hab, die abwechselnd Werte von sich geben.


Das ist ja soweit nicht alzuschwer. Hier der Code dafür, zumindest der Teil den ich geändert habe

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots   3


#property indicator_type1   DRAW_LINE
#property indicator_color1  clrOrangeRed
#property indicator_width1  2
#property indicator_label1  "Hull dn"

#property indicator_type2   DRAW_LINE
#property indicator_color2  clrMediumSeaGreen
#property indicator_width2  2
#property indicator_label2  "Hull up"


input int                inpPeriod  = 20;          // Period
input double             inpDivisor = 1.0;         // Divisor ("speed")
input ENUM_APPLIED_PRICE inpPrice   = PRICE_CLOSE; // Price

double val[],valc1[],valc2[];
//------------------------------------------------------------------
//
//------------------------------------------------------------------

int OnInit()
  {
   SetIndexBuffer(0,valc1,INDICATOR_DATA);
   SetIndexBuffer(1,valc2,INDICATOR_DATA);
   SetIndexBuffer(2,val,INDICATOR_CALCULATIONS);

   iHull.init(inpPeriod,inpDivisor);
   //IndicatorSetString(INDICATOR_SHORTNAME,"Hull ("+(string)inpPeriod+")");

   return (INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }

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 i=prev_calculated-1; if(i<0) i=0; for(i=0; i<rates_total && !_StopFlag; i++)
     {
      val[i]=iHull.calculate(getPrice(inpPrice,open,high,low,close,i),i,rates_total);

      if(i>0)
        {
         if(val[i] < val[i-1]) valc1[i]=val[i];
         else valc1[i]=EMPTY_VALUE;

         if(val[i] > val[i-1]) valc2[i]=val[i];
         else valc2[i]=EMPTY_VALUE;
      
        }
     }
   return(rates_total);
  }

die restlichen Funktionen hab ich nicht angegriffen, die sind ja auch nur für die Hull Calculation verantwortlich


jetzt habe ich im Chart immer eine Lücke



wie kann ich die wegbringen?

ich habe es schon versucht mit einem weiteren Buffer aber irgendwie ist das nie von Erfolg gekrönt


danke

Hull moving average
Hull moving average
  • www.mql5.com
Since then the HMA has found its way into charting programs around the world and is regularly discussed on traders bulletin boards in different languages around the world. It was the result of an intellectual curiosity which I placed into the public domain by writing the following article Alan Hul Hull Moving Average. The Hull Moving Average...
 
Beim Farbwechsel den Indikatorwert auch in die vorherige Bar eintragen.
 
Carl Schreiber:
Beim Farbwechsel den Indikatorwert auch in die vorherige Bar eintragen.

wie meinst Du das Carl?

 

Je nachdem wie die Linienpuffer organisiert sind bei einem Farbwechsel zB von Rot auf Grün:

if (...) { ... Grün[i+1] = Rot[i+1]; ...

Grund der Beschwerde: