// Downloaded From https://www.WiseStockTrader.com _SECTION_BEGIN("Movint trand Surrogate"); mtOpen = LinearReg( Open, 20 ); // calculate moving trend from open mtHigh = LinearReg( High, 20 ); // calculate moving trend from open mtLow = LinearReg( Low, 20 ); // calculate moving trend from open mtClose = LinearReg( Close, 20 ); // calculate moving trend from open // plot surrogate chart PlotOHLC( mtOpen, mtHigh, mtLow, mtClose, "Surrogate", colorBlack, styleCandle ); _SECTION_END(); prev=AMA2(C,1,0); d=IIf(C>Ref(Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),-1),Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))), IIf(CRef(state,-1); ss=stateRef(res,-1),1,IIf(C