//+------------------------------------------------------------------+ //|PARAMS: | //| - TimeFramePeriod: #of minutes in TF. | //|NOTE: | //| - I did not test non-standard TFs or a TimeFramePeriod | //| value less than that of current chart. So they probably | //| won't work. | //| - DeMarkerPeriod: self explanatory | //+------------------------------------------------------------------+ //mod2008fxtsd ki #property copyright "Copyright © 2006 ycomp" #property link "ycomp" //---- #define MIN_BARS_REQUIRED 200 // Just a safe amount here. Probably needs much less. //--- Indicator Settings #property indicator_separate_window #property indicator_level1 0.3 #property indicator_level2 0.7 #property indicator_buffers 1 #property indicator_color1 DodgerBlue #property indicator_width1 2 #property indicator_maximum 1 #property indicator_minimum 0 //---- input parameters extern int TimeFramePeriod; extern int DeMarkerPeriod=14; extern string TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN"; //---- buffers double buff[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { if (Bars < MIN_BARS_REQUIRED) return(-1); IndicatorDigits(Digits); SetIndexStyle(0, DRAW_LINE); SetIndexBuffer(0, buff); string paramDesc = "(" + getPeriodDesc(TimeFramePeriod) + ", " + DeMarkerPeriod + ")"; IndicatorShortName("MTF_DeMarker" + paramDesc); // Set Index Labels SetIndexLabel(0, "MTF_DeM" + paramDesc); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ string getPeriodDesc(int aNumMinutes) { switch(aNumMinutes) { case PERIOD_M1 : return("M1"); case PERIOD_M15: return("M15"); case PERIOD_M30: return("M30"); case PERIOD_H1 : return("H1"); case PERIOD_H4 : return("H4"); case PERIOD_D1 : return("D1"); case PERIOD_W1 : return("W1"); case PERIOD_MN1: return("MN1"); case 0: return("Chart"); default: return("M" + aNumMinutes); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double getDeMarker(int aShift) { return(iDeMarker(NULL,TimeFramePeriod,DeMarkerPeriod,iBarShift(NULL,TimeFramePeriod,Time[aShift]))); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int shift,limit; if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit = Bars-counted_bars; limit = MathMax(limit,TimeFramePeriod/Period()); for(shift=limit; shift>=0; shift--) { buff[shift]=getDeMarker(shift); } 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
Indicators Used:
DeMarker indicator
Custom Indicators Used:
Order Management characteristics:
Other Features: