//+------------------------------------------------------------------+ //| DayCandleAsStock.mq5| //| AlexALL | //| alex-all@mail.ru | //+------------------------------------------------------------------+ #property copyright "AlexALL" #property link "alex-all@mail.ru" #property version "1.00" //--- indicator settings #property indicator_chart_window #property indicator_buffers 5 #property indicator_plots 1 #property indicator_type1 DRAW_COLOR_CANDLES #property indicator_color1 Green, Red #property indicator_label1 "Day Candles As Stock" //--- input int HourBegin=9; input int HourEnd=23; //--- indicator buffers double ExtOBuffer[]; double ExtHBuffer[]; double ExtLBuffer[]; double ExtCBuffer[]; double ExtColorBuffer[]; datetime shift,arr[],arr2[]; int ishift; string symbol; //ChartSetSymbolPeriod(0,Symbol(),PERIOD_D1); //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,ExtOBuffer,INDICATOR_DATA); SetIndexBuffer(1,ExtHBuffer,INDICATOR_DATA); SetIndexBuffer(2,ExtLBuffer,INDICATOR_DATA); SetIndexBuffer(3,ExtCBuffer,INDICATOR_DATA); SetIndexBuffer(4,ExtColorBuffer,INDICATOR_COLOR_INDEX); //--- IndicatorSetInteger(INDICATOR_DIGITS,_Digits); //--- sets first bar from what index will be drawn IndicatorSetString(INDICATOR_SHORTNAME,"AsStock"); //--- sets drawing line empty value PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0); //--- initialization done if (ChartPeriod()!=PERIOD_D1) { ChartSetSymbolPeriod(0,Symbol(),PERIOD_D1); CopyTime(Symbol(),PERIOD_D1,0,iBars(Symbol(),PERIOD_D1),arr); ChartRedraw(); Sleep(100); } ChartSetInteger(0,CHART_MODE,CHART_LINE); long color1=ChartGetInteger(0,CHART_COLOR_BACKGROUND); ChartSetInteger(0,CHART_COLOR_CHART_LINE,color1); ChartSetInteger(0,CHART_FOREGROUND,false); shift=(HourEnd)*3600; if(HourEnd