Einzelnen Beitrag anzeigen
  #7 (permalink)  
Alt 11.10.22
Nefastus Nefastus ist offline
Mitglied
 
Registriert seit: Jun 2017
Ort: Lyss und Berlin
Beiträge: 31
Nefastus befindet sich auf einem aufstrebenden Ast
Standard der Fortschritt

Dank deinen Ausführlichen Schritten versteh selbst ich als Leihe was ich zu machen habe... Dafür Bedanke ich mich

Jetzt siht der Code so aus:

Code:
//|                                                                       Mein Linien Grid Indikator   ---+
//+-------------------------------------------------------------------------------------------------------+
#property strict
#property indicator_chart_window
#property indicator_buffers 4
//+---------------------------------------------------------------------------------   Chart Ausgabe   ---+
//+-------------------------------------------------------------------------------------------------------+
#property indicator_type1 DRAW_LINE
#property indicator_style1 STYLE_SOLID
#property indicator_width1 2
#property indicator_color1 clrOrange
#property indicator_label1 "Obere Linie"
//===
#property indicator_type2 DRAW_LINE
#property indicator_style2 STYLE_DASHDOT
#property indicator_width2 1
#property indicator_color2 clrCrimson
#property indicator_label2 "Oben - Abstand"
//===
#property indicator_type3 DRAW_LINE
#property indicator_style3 STYLE_DASHDOT
#property indicator_width3 1
#property indicator_color3 clrDodgerBlue
#property indicator_label3 "Unten + Abstand"
//===
#property indicator_type4 DRAW_LINE
#property indicator_style4 STYLE_SOLID
#property indicator_width4 2
#property indicator_color4 clrOrange
#property indicator_label4 "Untere Linie"
//+---------------------------------------------------------------------   Globale externe Variablen   ---+
//+-------------------------------------------------------------------------------------------------------+
input int      Kerzengroesse = 0;
input int      Perioden = 1500;
input double   Prozent  =  20;
//+-----------------------------------------------------------------------------   Globale Variablen   ---+
//+-------------------------------------------------------------------------------------------------------+
double bufferGanzOben[];
double bufferGanzUnten[];
double bufferObenMinAbstand[];
double bufferUntenPlAbstand[];
double price, rest, _Range, _EinProz, _Prozent;
int    BodyWidth = (int)ChartGetInteger(0,CHART_SCALE,2);
//+-------------------------------------------------------------------------------   OnInit Funktion   ---+
//+-------------------------------------------------------------------------------------------------------+
int OnInit() {
//===
   ChartSetInteger(0, CHART_SCALE, 0, Kerzengroesse);
   SetIndexBuffer(0, bufferGanzOben);
   SetIndexBuffer(1, bufferObenMinAbstand);
   SetIndexBuffer(2, bufferUntenPlAbstand);
   SetIndexBuffer(3, bufferGanzUnten);
//===
   return(INIT_SUCCEEDED);
}
//+-------------------------------------------------------------------------------  OnDeinit Funktion  ---+
//+-------------------------------------------------------------------------------------------------------+
void OnDeinit(const int reason) {
//===
   ChartSetInteger(0, CHART_SCALE, 2, BodyWidth);
}
//+--------------------------------------------------------------------------   OnCalculate Funktion   ---+
//+-------------------------------------------------------------------------------------------------------+
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 _CandlesOnChart = rates_total - prev_calculated;
   if(prev_calculated > 0) {
      _CandlesOnChart++;
   }
   for(int i = 0; i < _CandlesOnChart; i++) {
//===
      _CandlesOnChart = WindowFirstVisibleBar();
//===
      int _HighestCandle = iHighest(Symbol(), PERIOD_CURRENT, MODE_HIGH, _CandlesOnChart, 0);
      ObjectSetInteger(0, "_HighestCandle", OBJPROP_RAY, true);
      bufferGanzOben[i] = High[_HighestCandle];
//===
      int _LowestCandle = iLowest(Symbol(), PERIOD_CURRENT, MODE_LOW, _CandlesOnChart, 0);
      ObjectSetInteger(0, "_LowestCandle", OBJPROP_RAY, true);
      bufferGanzUnten[i] = Low[_LowestCandle];
//===
      _Range = (_HighestCandle - _LowestCandle);
      _Range = (bufferGanzOben[i] - bufferGanzUnten[i]);
      _EinProz = (_Range / 100);
      _Prozent = (_EinProz * Prozent);
//===
      bufferObenMinAbstand[i] = bufferGanzOben[i] - _Prozent;
      bufferUntenPlAbstand[i] = bufferGanzUnten[i] + _Prozent;
   }
   return(rates_total);
}
//===