Gp ATR stop
The GP ATR Stop refers to a stop-loss mechanism based on the Average True Range (ATR) indicator. With Amibroker AFL, traders can develop customized ATR-based stop-loss systems suitable for various trading strategies. Amibroker data feed integration ensures that these stop-loss levels dynamically adjust based on real-time market volatility, optimizing risk management.
/_SECTION_BEGIN("Bollinger Bands"); // Entry Rules : 1 - Piercing 2 - Grazing 3 - Piercing and Grazing 4 - Use RSI Rule=Param("RULES: 1-P, 2-G, 3-PZ, 4-RSI",1,1,4,1); P = ParamField("Price field",-1); Periods = Param("Periods", 20, 2, 300, 1 ); Width = Param("Width", 2, 0, 10, 0.05 ); UseRSI= ParamToggle("Use RSI", "No|Yes", 0); RSI_Periods = Param("RSI Periods", 14, 2, 300, 1 ); RSI_OB = Param("RSI OB", 70, 5, 300, 1 ); RSI_OS = Param("RSI OS", 30, 5, 300, 1 ); RiskAmount=Param("Risk Amount",300,50,10000,50); RiskRewardRatio=Param("Risk Reward Ratio ",1,0.1,100,0.1); Color = ParamColor("Color", colorCycle ); Style = ParamStyle("Style"); //Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); //PlotOHLC(Open,High,Low,Close,"",colorWhite,styleCandle); //Plot(C,"Price", colorBlack, styleCandle ); PlotOHLC(Open,High,Low,Close,"",colorWhite,styleCandle); Plot(BBandTop(C,Periods ,Width ), "BBTop" + _PARAM_VALUES(),colorDarkGreen,styleThick|styleDots); Plot(BBandBot(C,Periods ,Width ), "BBBot" + _PARAM_VALUES(),colorDarkGreen,styleThick|styleDots); //PlotOHLC(BBandTop(C,20,2.25), BBandTop(C,20,2.25),BBandTop(C,20,1),BBandTop(C,20, 1),"Cloud",colorGrey50,styleCloud|styleNoLabel); //PlotOHLC(BBandBot(C,20,2.25),BBandBot(C,20,2.25),BBandBot(C,20,1),BBandBot(C,20,1),"Cloud",colorGrey50 ,styleCloud|styleNoLabel); _SECTION_END(); bb202t = BBandTop(C, Periods , Width ); bb202b = BBandBot(C,Periods , Width ); green = OC; // without using RSI. piercing // prev prev bar is red and pierced bb bottom, prev bar is green and closed above bb bottom, buy at open of this bar BuyCond1 = Ref(Cross(bb202b,L ),-2) && Ref(red,-2) && Ref(green,-1) && Ref(C>bb202b,-1) ; // prev prev bar is green and pierced bb top, prev bar is red and closed below bb top, sell at open of this bar SellCond1 = Ref(Cross(H,bb202t ),-2) && Ref(green,-2) && Ref(red,-1) && Ref(C bb202t,-1) && Ref(green,-1) ; // prev prev bar is red and pierced bb bottom, prev bar is also red and pirced bb bottom, sell at open of this bar SellCond2 = Ref(Cross(bb202b,L),-2) && Ref(red,-2) && Ref(L