#property copyright "Copyright 2018, AZ-iNVEST" #property link "http://www.az-invest.eu" #property version "1.01" #property indicator_separate_window #property indicator_plots 0 #include RangeBarIndicator customChartIndicator; #define PREFIX_SEED "6D4E6" static long __chartId = ChartID(); static int __subWinId = ChartWindowFind(); enum ENUM_DISPLAY_FORMAT { DisplayFormat1 = 0, // 25 Jan 10:55 DisplayFormat2, // 25.01 10:55 }; input color InpTextColor = clrWhiteSmoke; // Font color input int InpFontSize = 9; // Font size input int InpSpacing = 8; // Date/Time spacing input ENUM_DISPLAY_FORMAT InpDispFormat = DisplayFormat1; // Display format //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping IndicatorSetString(INDICATOR_SHORTNAME,"\n"); IndicatorSetDouble(INDICATOR_MINIMUM,0); IndicatorSetDouble(INDICATOR_MAXIMUM,9); IndicatorSetInteger(INDICATOR_HEIGHT,28); IndicatorSetInteger(INDICATOR_DIGITS,0); //--- customChartIndicator.SetGetTimeFlag(); return(INIT_SUCCEEDED); } void OnDeinit(const int r) { ObjectsDeleteAll(__chartId,PREFIX_SEED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ 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[]) { if(!customChartIndicator.OnCalculate(rates_total,prev_calculated,time)) return(0); int start = customChartIndicator.GetPrevCalculated() - 1; //--- correct position if(start<0) start=0; if((start == 0) || customChartIndicator.IsNewBar) { ObjectsDeleteAll(__chartId,PREFIX_SEED); DrawTimeLine(0,rates_total,time); } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ void DrawTimeLine(const int nPosition, const int nRatesCount, const datetime &canvasTime[]) { datetime curBarTime = 0; bool _start = false; int c = 0; for(int i=nPosition;i