//+------------------------------------------------------------------+ //| MTF Band Level.mq4 | //| Copyright © 2009, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2009, Darkkiller and Mladen" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 White #property indicator_color2 DimGray #property indicator_color3 DimGray extern bool Show_Bands=false; extern int TimeFrame = 0; extern string TimeFrames = "1,5,15,30,60,240,1440,10080.43200"; double MovingBuffer[]; double UpperBuffer[]; double LowerBuffer[]; int deinit() { ObjectDelete("dk mtfbandslevel"); return(0); } //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SetIndexBuffer(0,MovingBuffer); SetIndexBuffer(1,UpperBuffer); SetIndexBuffer(2,LowerBuffer); if (Show_Bands) SetIndexStyle(0,DRAW_LINE); else SetIndexStyle(0,DRAW_NONE); if (Show_Bands) SetIndexStyle(1,DRAW_LINE); else SetIndexStyle(1,DRAW_NONE); if (Show_Bands) SetIndexStyle(2,DRAW_LINE); else SetIndexStyle(2,DRAW_NONE); return(0); } //---- //+------------------------------------------------------------------+ //| MTF BBFibo | //+------------------------------------------------------------------+ int start() { datetime TimeArray[]; int i,limit,y=0,counted_bars=IndicatorCounted(); if ((TimeFrame<Period()) && (TimeFrame>0)) { Comment("Lower timeframe band have been removed from chart"); return(-1); } ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); limit = MathMax(Bars - counted_bars,MathMax(TimeFrame/Period(),1)); for(i=0,y=0;i<limit;i++) { if (Time[i]<TimeArray[y]) y++; MovingBuffer[i]=iCustom(Symbol(),TimeFrame,"Bands Level",0,y); UpperBuffer[i]=iCustom(Symbol(),TimeFrame,"Bands Level",1,y); LowerBuffer[i]=iCustom(Symbol(),TimeFrame,"Bands Level",2,y); } string signature = "dk mtfbandslevel"; ObjectDelete(signature); ObjectCreate( signature, OBJ_LABEL, 0, 0, 0 ); ObjectSetText(signature,"|dk|",7, "Arial Bold", DimGray); ObjectSet( signature, OBJPROP_CORNER, 3 ); ObjectSet( signature, OBJPROP_XDISTANCE, 10); ObjectSet( signature, OBJPROP_YDISTANCE, 1); return(0); }
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Indicator Curves created:
Implements a curve of type DRAW_LINE
Implements a curve of type DRAW_NONE
Indicators Used:
Custom Indicators Used:
Bands Level
Order Management characteristics:
Other Features: