// Downloaded From https://www.WiseStockTrader.com Plot( Close, "Price", 47, styleCandle ); _SECTION_BEGIN(" NMA-TRADING"); k = Optimize("mult",Param("mult",1.25,1,2,0.25),1,2,0.25); Per= Optimize("period",Param("period",10,5,50,1),5,50,1); HaClose=(O+H+L+C)/4; HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); HaHigh = Max( H, Max( HaClose, HaOpen ) ); HaLow = Min( L, Min( HaClose, HaOpen ) ); ms=ParamList("ST0P/REV",List="Reg|Smoothed",0); if(ms=="Reg") {nm =(H-L); j=(O+H+L+C)/4; } else {nm=(HaHigh-HaLow); j=(HaOpen+HaHigh+HaLow+HaClose)/4; } rfsctor = WMA(nm, PER); revers = K * rfsctor; Trend = 1; NW[0] = 0; for(i = 1; i < BarCount; i++) { if(Trend[i-1] == 1) { if(j[i] < NW[i-1]) { Trend[i] = -1; NW[i] = j[i] + Revers[i]; } else { Trend[i] = 1; if((j[i] - Revers[i]) > NW[i-1]) { NW[i] = j[i] - Revers[i]; } else { NW[i] = NW[i-1]; } } } if(Trend[i-1] == -1) { if(j[i] > NW[i-1]) { Trend[i] = 1; NW[i] = j[i] - Revers[i]; } else { Trend[i] = -1; if((j[i] + Revers[i]) < NW[i-1]) { NW[i] = j[i] + Revers[i]; } else { NW[i] = NW[i-1]; } } } } Plot(NW, "", IIf(Trend == 1, 3, 3), 4); if(ms=="Reg") { Buy=Cover=Cross(j,nw); Sell=Short=Cross(nw,j); } else { B = Cross(j,nw); S = Cross(nw,j); Buysetup=Flip(b,s); Shortsetup=Flip(s,b); BuySetupValue = ValueWhen(b,H,1); ShortsetupValue = ValueWhen(s,L,1); b1= Buysetup AND Cross(C,BuySetupValue); s1= Shortsetup AND Cross(ShortsetupValue,C); Buy=b1; Short=s1; Sell=Shortsetup; Cover=Buysetup; } Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); Short=ExRem(Short,Cover); Cover=ExRem(Cover,Short); PlotShapes(IIf(Buy, shapeUpTriangle, shapeNone),colorSkyblue, 0,Low,-25); PlotShapes(IIf(Sell, shapeHollowSmallDownTriangle, shapeNone),colorLightYellow, 0,High,-15); PlotShapes(IIf(Cover, shapeHollowSmallUpTriangle, shapeNone),colorSkyblue, 0,Low,-15); PlotShapes(IIf(Short, shapeDownTriangle, shapeNone),colorLightYellow, 0,High,-25); if( Status("action") == actionIndicator ) ( Title = EncodeColor(colorWhite)+ "NMA Optimiser 3.6 a ("+k+" - "+per+" - "+ms+")" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) + Date()+"\n"+EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+ "Cl-"+C+" "+""+"Vol= "+ WriteVal(V)+"\n" ); _SECTION_BEGIN("Background text"); Font= ParamList("Font:","Arial|Calibri|Futura|Tahoma|MS Sans Serif|Times New Roman ",4); C13=Param("fonts size",12,6,14,1 ); C14=Param("Text shift",100,50,150,5 ); Miny = Status("axisminy"); Maxy = Status("axismaxy"); lvb = Status("lastvisiblebar"); fvb = Status("firstvisiblebar"); pxwidth = Status("pxwidth"); pxheight = Status("pxheight"); GfxSetBkMode( 0 ); GfxSetOverlayMode(1); GfxSetTextAlign( 6 ); GfxSelectFont(Font, C13, 700, False, False, 0); GfxSetTextColor(1); GfxTextOut(" NMA Optimiser v3.6 ", Status("pxwidth")/2 , Status("pxheight")/3 ); _SECTION_END();