//+------------------------------------------------------------------+ //| DayATR.mq4 | //| Copyright 2010-2015, Excstrategy | //| http://www.ExcStrategy.ru | //+------------------------------------------------------------------+ #property copyright "ExcStrategy" #property link "http://www.ExcStrategy.ru" #property version "1.1" #property description "Average True Range" #property strict //+------------------------------------------------------------------+ #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Blue #property indicator_width1 1 //---- extern int DaysForCalculation=2; //---- buffers double Buffer1[]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(1); //---- indicator lines SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,Buffer1); //---- SetIndexLabel(0,"ATR"); //---- DaysForCalculation=DaysForCalculation+1; //---- return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { if(Period()>1400) { Alert("Error! Period can not be greater than D1"); return(0); } //---- int counted_bars=IndicatorCounted(); int barsday; datetime Time1=Time[0],Time2; //---- if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars; //---- for(int i=0; i