Hallo Leute..
Der Indikator soll eigentlich bei jeder zutreffenden Bedingung nicht nur einen Pfeil zeichnen sondern auch ein farbiges Rechteck um die beiden Kerzen.
Das High und Low der Signalkerze gibt die Höhe des Rechteckes an.
Start und Endpunkt des Rechtecks sind jeweils 2 Kerzen.
Warum macht der Indikator jetzt nur einmalig ein rechteck und nicht wie die Pfeile überall eins?
Könnte mir jemand bitte den Code richtig umstellen und es erklären?
Code:
#property copyright "Tommy"
#property link "https://www.mql5.com"
#property version "1.00"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Blue
double Buytrigger[];
double Selltrigger[];
double Signal[];
extern int Feldfarbe = PaleGreen;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY);
SetIndexArrow(0, 234);
SetIndexBuffer(0, Signal);
SetIndexBuffer(1, Buytrigger);
SetIndexBuffer(2, Selltrigger);
//----
SetIndexLabel(0,"Signal");
SetIndexLabel(1,"Buytrigger");
SetIndexLabel(2,"Selltrigger");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
limit=Bars-counted_bars;
//---
for(int i=1; i<limit; i++)
{
double EH = iHigh(NULL,0,i+1);
double EL = iLow(NULL,0,i+1);
double ZH = iHigh(NULL,0,i);
double ZL = iLow(NULL,0,i);
double atr = iATR(_Symbol, 0, 100, i)*0.5;
if ((ZH > EH || ZH == EH) && (ZL < EL || ZL == EL))
{
Buytrigger[i] = High[i];
Selltrigger[i] = Low[i];
Signal[i] = High[i] + atr;
ObjectCreate("Rechteck", OBJ_RECTANGLE, 0, Time[i], High[i], Time[i+1], Low[i]);
ObjectSetInteger(0,"Rechteck",OBJPROP_COLOR,Feldfarbe);
}
}
return(0);
}