// Downloaded From https://www.WiseStockTrader.com _SECTION_BEGIN("Extreme Keltner using ATR"); //SetChartOptions(2,chartShowArrows|chartShowDates); //SetBarFillColor( IIf( Close > Open, colorDarkGreen, colorRed ) ); //SetTradeDelays(1,1,0,0); //BuyPrice = C; //SellPrice = C; Mid = MA( (H+L+C)/3, 15); //The 10-Day Moving Average Hi = Mid + 4*ATR(15); //Upper Keltner Band Lo = Mid - 4*ATR(15); //Lower Keltner Band Buy = Cross(Open, Lo); //Buy Trigger on day the stock Opens above lower Keltner BuyPrice = Open; //Price Sell = Ref( Buy, -1 ); //Sell following day at open SellPrice = Open; //Plot stuff Plot(Mid,"Mid",colorBlue,styleLine); Plot(Hi,"Hi",colorGreen,styleLine); Plot(Lo,"lo",colorGreen,styleLine); Plot(C,"C",colorBlack,styleCandle); // plotting prices at the correct level Plot(C,"Close",colorBlack,styleBar); PlotShapes( IIf(Buy, shapeSmallCircle, shapeNone),colorGreen, 0, BuyPrice, 0 ); PlotShapes( IIf( Sell, shapeSmallCircle, shapeNone),colorRed, 0 ,SellPrice, 0 ); FirstVisibleBar = Status( "FirstVisibleBar" ); Lastvisiblebar = Status("LastVisibleBar"); for( b = Firstvisiblebar; b <= Lastvisiblebar AND b < BarCount; b++) { if( Buy[b] ) PlotText("\n Buy\n "+NumToStr(BuyPrice[b],1.2),b,BuyPrice[b]-1,colorBlack); else if( Sell[b] ) PlotText("\n Sell\n "+NumToStr(SellPrice[b],1.2),b,SellPrice[b]-1, IIf(SellPrice[b]>BuyPrice[b-1], colorGreen, colorRed)); } _SECTION_END();