//+------------------------------------------------------------------ #property copyright "mladen" #property link "mladenfx@gmail.com" #property link "https://www.mql5.com" #property description "ATR Probability Levels" //+------------------------------------------------------------------ #property indicator_chart_window #property indicator_buffers 0 #property indicator_plots 0 //--- input parameters input ENUM_TIMEFRAMES inpTimeFrame = PERIOD_D1; // Timeframe for data input int inpAtrPeriod = 21; // ATR period input color inpUp = clrDeepSkyBlue; // Color for high levels input color inpDn = clrOrangeRed; // Color for low levels input string inpUniqueID = "AtrLevels1"; // Unique ID for objects input int inpLabelsShift = 10; // Labels shift //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { return (INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { ObjectsDeleteAll(0,inpUniqueID+":"); return; } //+------------------------------------------------------------------+ //| 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[]) { MqlRates _rates[]; int _ratesCopied=CopyRates(_Symbol,inpTimeFrame,1,inpAtrPeriod+1,_rates); if(_ratesCopied != inpAtrPeriod+1) return(prev_calculated); double _atr = 0; for(int k=0;k