//+------------------------------------------------------------------+ //| LifeHack Ticks.mq5 | //| Copyright © 2016, Vladimir Karputov | //| http://wmua.ru/slesar/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2016, Vladimir Karputov" #property link "http://wmua.ru/slesar/" #property version "1.003" #property description "Tick Indicators" #property indicator_separate_window #property indicator_buffers 4 #property indicator_plots 2 //--- plot Ask #property indicator_label1 "Ask" #property indicator_type1 DRAW_LINE #property indicator_color1 clrRed #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot Bid #property indicator_label2 "Bid" #property indicator_type2 DRAW_LINE #property indicator_color2 clrBlue #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- indicator buffers double AskBuffer[]; double BidBuffer[]; double AskBufferTemp[]; double BidBufferTemp[]; //--- parameters int InpVisible=300; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,AskBuffer,INDICATOR_DATA); SetIndexBuffer(1,BidBuffer,INDICATOR_DATA); SetIndexBuffer(2,AskBufferTemp,INDICATOR_CALCULATIONS); SetIndexBuffer(3,BidBufferTemp,INDICATOR_CALCULATIONS); PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0); PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0); PlotIndexSetDouble(2,PLOT_EMPTY_VALUE,0); PlotIndexSetDouble(3,PLOT_EMPTY_VALUE,0); ArraySetAsSeries(AskBuffer,true); ArraySetAsSeries(BidBuffer,true); ArraySetAsSeries(AskBufferTemp,true); ArraySetAsSeries(BidBufferTemp,true); //--- name for DataWindow and indicator subwindow label IndicatorSetString(INDICATOR_SHORTNAME,"LifeHack Ticks "); //--- construct a short indicator name based on input parameters IndicatorSetInteger(INDICATOR_DIGITS,Digits()); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| 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(prev_calculated==0) { for(int i=0;i