Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL4 (http://www.expert-advisor.com/forum/forumdisplay.php?f=220)
-   -   Mein erster Indikator (http://www.expert-advisor.com/forum/showthread.php?t=1883)

Freeze 26.01.12 21:08

Mein erster Indikator
 
Hi,
ich versuche mich gerade an meinem ersten indikator und verstehe nicht, wie diese DRAW_HISTOGRAMM-Funktion funktioniert.
Der Indikator soll einfach nur 2 Gleitende Durchschnitte zeichnen und ein Histogramm zwischen die beiden Kurven zeichnen.
Wenn ich diesen Indikator aber auf den Chart anwende stimmt 1. die Strichdicke nicht, 2. auch nicht die Linienart und 3. sieht man den weißen MA nicht.
Kann mir jemand sagen was hier alles nicht stimmt ?

HTML-Code:

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Yellow
#property indicator_color4 White

extern int Aver_Bars=5;

double Buf_0[],Buf_1[],Buf_2[],Buf_3[];
//--------------------------------------------------------------------
int init()
  {
//--------------------------------------------------------------------
  SetIndexBuffer(0,Buf_0);
  SetIndexStyle (0,DRAW_HISTOGRAM,STYLE_SOLID,1);
//--------------------------------------------------------------------
  SetIndexBuffer(1,Buf_1);
  SetIndexStyle (1,DRAW_HISTOGRAM,STYLE_SOLID,1);
//--------------------------------------------------------------------
  SetIndexBuffer(2,Buf_2);
  SetIndexStyle(2,DRAW_LINE,STYLE_DOT,1);
//--------------------------------------------------------------------
  SetIndexBuffer(2,Buf_3);
  SetIndexStyle(2,DRAW_LINE,STYLE_DOT,1);

//--------------------------------------------------------------------
  return;
  }
//--------------------------------------------------------------------
int start()
  {
  int i,
      n,
      Counted_bars;
      double
      Sum_H,
      Sum_L;
//--------------------------------------------------------------------
  Counted_bars=IndicatorCounted();
  i=Bars-Counted_bars-1;
  while(i>=0)
    {
      Sum_H=0;
      Sum_L=0;
      for(n=i;n<=i+Aver_Bars-1;n++)
        {
        Sum_H=Sum_H + High[n];
        Sum_L=Sum_L + 1.01*Low[n];
        }
      Buf_0[i]=Sum_H/Aver_Bars;
      Buf_1[i]=Sum_L/Aver_Bars;
      Buf_2[i]=Sum_H/Aver_Bars;
      Buf_3[i]=Sum_L/Aver_Bars;
      i--;
    }
//--------------------------------------------------------------------
  return;
  }
//--------------------------------------------------------------------



Alle Zeitangaben in WEZ +2. Es ist jetzt 00:01 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum