//+------------------------------------------------------------------+ //| smACME Rectangle_v1 //+------------------------------------------------------------------+ #property copyright "Copyright © 02.08.2020, SwingMan" #property link "" #property indicator_chart_window #property strict /*-------------------------------------------------------------------- 02.08.2020 - v2.1 - algorithmus changed 01.08.2020 - v1.0 - first version CONWAY, BEHLE: Professional Stock Trading, System Design and Automation 12.09.2012 initial- smPA_PriceControlLines_v1 --------------------------------------------------------------------*/ //---- input parameters //+------------------------------------------------------------------+ input int RectangleLength=4; input int RangeLength =12; input int ATR_Period =30; input double ATR_RangeFactor =1.1; input double RangeRatioLimit =1.5; input int MiddleLine_Length=10; extern int maxBars = 1500; input bool Draw_Areas=true; input bool Show_IndicatorName=true; //+------------------------------------------------------------------+ //---- variables string CR="\n"; datetime thisTime,oldTime; bool newBar; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- name for DataWindow and indicator subwindow label string short_name=WindowExpertName(); IndicatorShortName(short_name); if(Show_IndicatorName==true) Comment(short_name,CR, "================="); int limitBars=Bars-RectangleLength-RangeLength-10; maxBars=MathMin(maxBars,limitBars); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { ObjectsDeleteAll(0,"Rectangle_"); ObjectsDeleteAll(0,"PCLine1_"); ObjectsDeleteAll(0,"PCLine2_"); ObjectsDeleteAll(0,"Middle_"); if(Show_IndicatorName==true) Comment(""); return(0); } //#################################################################### //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit,checkBar; datetime time1, time2; double highValue,lowValue; int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- main loop checkBar=0; while(checkBar