- Code: Select all
//+------------------------------------------------------------------+
//| SSL.mq4 |
//+------------------------------------------------------------------+
//----
#property indicator_buffers 1
#property indicator_color1 Blue
extern int Periode=10;
double hilo_buffer[],newPlot=0,lastPlot=0;
double avgHigh=0,avgLow=0;
int ExtCountedBars=0;
int barsstart,bardiff,mod,cnt;
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0,hilo_buffer);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
ExtCountedBars=IndicatorCounted();
Print("ExtCount="+ExtCountedBars);
Print("Bars="+Bars);
barsstart=Bars;
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{double m,q1,q2,q3,q4;
int p,hidx,lidx;
//--- ---
p=Period(); //in minuten;
//4wochen = 4w * 5.5tage * 24h *60min = 31680 min / 4 wochen
//p=1 => cnt=28800
//p=1440 => cnt=28800/1440
//cnt=31680/p; //bei 6 wochen 30tage * 24h * 60min = 43200
hidx=iHighest(NULL,PERIOD_D1, MODE_HIGH,23,0); //hmmmm
lidx=iLowest(NULL,PERIOD_D1, MODE_LOW,23,0); //hmmmm
q4=iHigh(NULL,PERIOD_D1,hidx);
q1=iLow(NULL,PERIOD_D1,lidx);
/*
hidx=iHighest(NULL,0, MODE_HIGH,cnt,0); //hmmmm
lidx=iLowest(NULL,0, MODE_LOW,cnt,0); //hmmmm
q4=iHigh(NULL,0,hidx);
q1=iLow(NULL,0,lidx);
*/
m=(q4+q1)/2;
q2=(q1+m)/2;
q3=(m+q4)/2;
//--- ---
ObjectDelete("Q1Line");
ObjectDelete("Q2Line");
ObjectDelete("MLine");
ObjectDelete("Q3Line");
ObjectDelete("Q4Line");
//--- ---
ObjectCreate("Q1Line", OBJ_HLINE,0, CurTime(),q1);
ObjectSet("Q1Line", OBJPROP_COLOR, Green);
ObjectSet("Q1Line", OBJPROP_STYLE, STYLE_DASH);
//--- ---
ObjectCreate("Q2Line", OBJ_HLINE,0, CurTime(),q2);
ObjectSet("Q2Line", OBJPROP_COLOR, Green);
ObjectSet("Q2Line", OBJPROP_STYLE, STYLE_DASH);
//--- ---
ObjectCreate("MLine", OBJ_HLINE,0, CurTime(),m);
ObjectSet("MLine", OBJPROP_COLOR, Yellow);
ObjectSet("MLine", OBJPROP_STYLE, STYLE_DASH);
//--- ---
ObjectCreate("Q3Line", OBJ_HLINE,0, CurTime(),q3);
ObjectSet("Q3Line", OBJPROP_COLOR, Red);
ObjectSet("Q3Line", OBJPROP_STYLE, STYLE_DASH);
//--- ---
ObjectCreate("Q4Line", OBJ_HLINE,0, CurTime(),q4);
ObjectSet("Q4Line", OBJPROP_COLOR, Red);
ObjectSet("Q4Line", OBJPROP_STYLE, STYLE_DASH);
return(0);
}
//+------------------------------------------------------------------+