//+------------------------------------------------------------------+ //| Sep_Window_2.mq5 | //| Steve Van Laer | //| http://www.stevevanlaer.com | //+------------------------------------------------------------------+ #property copyright "Steve Van Laer" #property link "http://www.stevevanlaer.com" #property version "1.00" #property indicator_separate_window #property indicator_buffers 2 #property indicator_plots 2 //--- plot Close #property indicator_label1 "Close" //Buffer for close prices #property indicator_type1 DRAW_LINE #property indicator_color1 clrYellow #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot Indicator #property indicator_label2 "Indicator" //Buffer for calculated values #property indicator_type2 DRAW_LINE #property indicator_color2 clrDodgerBlue #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- input parameters input int NumBars=14; //Number of bars to go backwards //--- indicator buffers double CloseBuffer[]; double IndicatorBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,CloseBuffer,INDICATOR_DATA); SetIndexBuffer(1,IndicatorBuffer,INDICATOR_DATA); //---- sets drawing line empty value-- PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0); PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0.0); //--- 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[]) { //--- 1) Check if enough bars if(rates_total