Einzelnen Beitrag anzeigen
  #1 (permalink)  
Alt 22.12.23
thecreating thecreating ist offline
Neues Mitglied
 
Registriert seit: Dec 2023
Beiträge: 1
thecreating befindet sich auf einem aufstrebenden Ast
Standard 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.