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 MQL5 (http://www.expert-advisor.com/forum/forumdisplay.php?f=221)
-   -   Indikator wird nicht angezeigt (http://www.expert-advisor.com/forum/showthread.php?t=7376)

thecreating 22.12.23 11:52

Indikator wird nicht angezeigt
 
Hallo Freunde und Helfer

Ich habe einen einfachen Indikator in MTQL5 geschrieben der Vortageshoch und Vortagestief ausgeben soll.

Es gibt keine Fehlermeldungen und dennoch lässt sich der Indikator nicht im Chart anzeigen.

Code:

#property strict
#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 clrBlue
#property indicator_color2 clrRed
#property indicator_style1 STYLE_DASHDOT
#property indicator_style2 STYLE_DASHDOT
#property indicator_label1 "Vortageshoch"
#property indicator_label2 "Vortagestief"

double arrHigh[];
double arrLow[];

int OnInit(){

  SetIndexBuffer(0,arrHigh);
  SetIndexBuffer(1,arrLow);
 
  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[]){
               
   
    static double lastHigh = 0;
    static double lastLow = INT_MAX;
   
    static double currentHigh = 0;
    static double currentLow = INT_MAX;
   
    static datetime timestamp = 0;
    for(int i = rates_total-prev_calculated; i >= 0; i--){   
              if(i >= rates_total) continue;
             
              datetime timeDay = iTime(_Symbol,PERIOD_D1,iBarShift(_Symbol,PERIOD_D1,time[i]));
              if(timestamp != timeDay){
                  timestamp = timeDay;
                 
                  currentHigh = lastHigh;
                  currentLow = lastLow;
                  lastHigh = 0;
                  lastLow = INT_MAX;             
                }
               
            lastHigh = MathMax(lastHigh,high[i]);
            lastLow = MathMin(lastLow,low[i]);
           
            arrHigh[i] = currentHigh;
            arrLow[i] = currentLow;
                         
            }

      return(rates_total);
}

Hoffe mir kann jemand bei dem Problem helfen.


Alle Zeitangaben in WEZ +2. Es ist jetzt 15:35 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