// Downloaded From https://www.WiseStockTrader.com /*------------------------------------------------------------------------ Directional Bias Trailing Stop for Amibroker modified from Leon Wilson -------------------------------------------------------------------------*/ Value3 = Param("Channel Periods",34, 7, 55); Value4 = Param("OverBought Region",75,55, 90 ); Value6 = Param("Initial Stop",0,0, 10000 ); StpLvl= Param("StopLevel",66,1,236,1); /*Adjust to keep the stop from dropping past the relevant low*/ MCT = (Sum(abs(Close -Ref(Close,-1)),5))/5; up = PDI(Value3); down = MDI(Value3); Index = 100-(100/(1+(up/down+0.0001))); OB = (Index -Value4); Bullish = Close-(Close*(OB/100)); DBiasStop = IIf(Bullish >= Close,Low -(Bullish - Close ), Low ); if( ParamToggle("Combine DynamicBR & Directional Bias?", "No|Yes" ) ) DBiasStop = IIf(DBiasStop >= DBRStop, DBiasStop, DBRStop ); DBiasStopARR = HHV(DBiasStop, StpLvl ); StopMCT = DBiasStop - MCT; StopMCTArr = HHV(StopMCT, StpLvl ); Plot(DBiasStopArr, "", colorBlue, styleThick ); Plot(StopMCTArr, "", colorRed, styleDots );