Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
wma200 ma200 for Amibroker (AFL)
Copy & Paste Friendly
Back
/////////////////////////////////////////////////////////////////////////////////////// TDBHL = ParamToggle("WMA14","Hide|Show",0); if(TDBHL==1) { _SECTION_BEGIN("WMA14"); P = ParamField("Price field",-1); Periods = Param("Periods", 14, 2, 300, 1, 10 ); Plot( WMA( P, 14 ), "WMA(14)", colorGreen, ParamStyle("Style") ); _SECTION_END(); } TDBHL = ParamToggle("WMA21","Hide|Show",0); if(TDBHL==1) { _SECTION_BEGIN("WMA21"); P = ParamField("Price field",-1); Periods = Param("Periods", 21, 2, 300, 1, 10 ); Plot( WMA( P, 21 ), "WMA(21)", colorRed, ParamStyle("Style") ); _SECTION_END(); } TDBHL = ParamToggle("WMA34","Hide|Show",0); if(TDBHL==1) { _SECTION_BEGIN("WMA34"); P = ParamField("Price field",-1); //Periods = Param("Periods",8, 2, 300, 1, 10 ); Plot( WMA( P, 23), "WMA(34)", colorDarkOliveGreen, ParamStyle("Style") ); _SECTION_END(); } TDBHL = ParamToggle("WMA50","Hide|Show",0); if(TDBHL==1) { _SECTION_BEGIN("WMA50"); P = ParamField("Price field",-1); Periods = Param("Periods", 50, 2, 300, 1, 10 ); Plot( WMA( P, 50 ), "WMA(50)", colorPink, ParamStyle("Style") ); _SECTION_END(); } TDBHL = ParamToggle("WMA100","Hide|Show",0); if(TDBHL==1) { _SECTION_BEGIN("WMA100"); P = ParamField("Price field",-1); Periods = Param("Periods", 100, 2, 300, 1, 10 ); Plot( WMA( P, 100 ), "WMA(100)", ParamColor( "Color", colorCycle ), ParamStyle("Style") ); _SECTION_END(); } TDBHL = ParamToggle("WMA200","Hide|Show",1); if(TDBHL==1) { _SECTION_BEGIN("WMA200"); P = ParamField("Price field",-1); Periods = Param("Periods", 200, 2, 300, 1, 10 ); Plot( WMA( P, 200), "WMA(200)", colorGreen, 8 ); _SECTION_END(); } TDBHL = ParamToggle("MA200","Hide|Show",1); if(TDBHL==1) { _SECTION_BEGIN("MA200"); P = ParamField("Price field",-1); Periods = Param("Periods", 200, 2, 300, 1, 10 ); Plot( WMA( P, 200), "MA(200)", colorRed, 8 ); _SECTION_END(); } _SECTION_BEGIN("AFL"); act = 0.1; acl = 0.06; Buy = Cross(Open,SAR(act,acl)); Sell = Cross(SAR(act,acl), Open ); PlotShapes(IIf(Buy,shapeUpArrow,shapeNone), colorGreen, 0, Low, Offset=-15); PlotShapes(IIf(Buy,shapeSmallCircle,shapeNone), colorGreen, 0, Low, Offset=-28); PlotShapes(IIf(Sell, shapeDownArrow,shapeNone), colorRed, 0, High, Offset=-15); PlotShapes(IIf(Sell, shapeSmallCircle,shapeNone), colorRed, 0, High, Offset= 28); SetChartOptions(0,chartShowArrows|chartShowDates); _N(Title = StrFormat("{{NAME}}-{{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )); function GetSecondNum() { Time = Now( 4 ); Seconds = int( Time % 100 ); Minutes = int( Time / 100 % 100 ); Hours = int( Time / 10000 % 100 ); SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds ); return SecondNum; } RequestTimedRefresh( 1 ); TimeFrame = Interval(); SecNumber = GetSecondNum(); Newperiod = SecNumber % TimeFrame == 0; SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame; SecsToGo = TimeFrame - SecsLeft; x=Param("xposn",4,0,1000,1); y=Param("yposn",17,0,1000,1); GfxSetBkMode(1); GfxSelectFont( "Arial", 9, 700, False ); GfxSetTextColor( colorPaleBlue ); GfxTextOut( ""+SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y ); SetChartOptions(0,chartShowArrows|chartShowDates); _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )); Plot( C, "Close", colorBlack , styleNoTitle | styleCandle | GetPriceStyle() ); messageboard = 0; showsl = 0; no=10; res=HHV(H,no); sup=LLV(L,no); avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0)); avn=ValueWhen(avd!=0,avd,1); s5d=IIf(avn==1,sup,res); if (showsl == 0) exitlong = Cross(s5d, C); exitshort = Cross(C, s5d); Buy = exitshort; Sell = exitlong; Short = Sell; Cover = Buy; Buy = ExRem(Buy,Sell); Sell = ExRem(Sell,Buy); Short = ExRem(Short, Cover); Cover = ExRem(Cover, Short); for(i=BarCount-1;i>1;i--) { if(Buy[i] == 1) { entry = C[i]; sig = "BUY"; sl = s5d[i]; tar1 = entry + (entry * .0060); tar2 = entry + (entry * .0120); tar3 = entry + (entry * .0220); bars = i; i = 0; } if(Sell[i] == 1) { sig = "SELL"; entry = C[i]; sl = s5d[i]; tar1 = entry - (entry * .0060); tar2 = entry - (entry * .0120); tar3 = entry - (entry * .0220); bars = i; i = 0; } } Offset = 20; Clr = IIf(sig == "BUY", colorLime, colorOrange); ssl = IIf(bars == BarCount-1, s5d[BarCount-1], Ref(s5d, -1)); sl = ssl[BarCount-1]; Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset); Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset); Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset); Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorLightBlue, styleLine|styleDots, Null, Null, Offset); for (i=bars; i <BarCount;i++) if (messageboard == 0 ) { GfxSelectFont( "Tahoma", 13, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorWhite ); if ( sig =="BUY") { GfxSelectSolidBrush( colorGreen ); } else { GfxSelectSolidBrush( colorRed); } pxHeight = Status( "pxchartheight" ) ; xx = Status( "pxchartwidth"); width = 200; x = 5; x2 = 180; y = pxHeight; GfxSelectPen( colorLightBlue, 1); GfxRoundRect( x, y - 163, x2, y , 7, 7 ) ; GfxTextOut( (" FREE AFL"),30,y-160); GfxTextOut( ("Trailing SL : " + sl), 18, y-140); GfxTextOut( ("Target:1 : " + tar1), 18, y -120); GfxTextOut( ("Target:2 : " + tar2), 18,y-100); GfxTextOut( ("Target:3 : " + tar3), 18,y-80); GfxTextOut( ("-----------------------"),18,y-60); GfxTextOut( ("Get Realtime Data"),18,y-40); } function PlotDT() { for (i=BarCount-1;i > 1; i--) { if(NewDay[i] == 1) { printf("High : " + i); if(width == 1) { DL = IIf(O[i] < C[i], O[i], C[i]); DH = IIf(O[i] > C[i], O[i], C[i]); } else { DL = L[i]; DH = H[i]; } Bars = i; i = -1; } } if(slmode==1) { distance = displacement; } else { distance = ((DH+DL)/2) * .01; } Plot(LineArray(BarCount - (BarCount-Bars+20), DH, BarCount+35, DH, 1), "", colorLime, styleLine|styleThick|styleDots, Null, Null, 20); PlotText("Buy Above " + DH + "; Stop Loss = " + DL, BarCount + 0, DH, colorBlack, colorLime); Plot(LineArray(BarCount - (BarCount-Bars+20), (DH+ distance), BarCount+35, (DH+ distance), 1), "", colorLime, styleLine|styleThick|styleDots, Null, Null, 20); PlotText("Target = " + (DH+ distance), BarCount + 0, (DH+ distance), colorBlack, colorLime); Plot(LineArray(BarCount - (BarCount-Bars+20), DL, BarCount+35, DL, 1), "", colorOrange, styleLine|styleThick|styleDots, Null, Null, 20); PlotText("Sell Below " + DL + "; Stop Loss = " + DH, BarCount + 0, DL, colorBlack, colorOrange); Plot(LineArray(BarCount - (BarCount-Bars+20), (DL-distance), BarCount+35, (DL-distance), 1), "", colorOrange, styleLine|styleThick|styleDots, Null, Null, 20); PlotText("Target = " + (DL-distance), BarCount + 0, (DL-distance), colorBlack, colorOrange); } function PlotIndicators() { SetChartOptions(0,chartShowArrows|chartShowDates); Periods = Param("Standard Error", 80, 3, 200, 1); Smooth = Param("Smooth",14,2,100,1); LRCurve = LinearReg( C, periods ); MALRCurve = MA(LRCurve, Smooth); SEValue = StdErr( C, periods ); SErrorAvg = MA(SEValue, Smooth); LowerBand = MALRCurve - SErrorAvg ; UpperBand = MALRCurve + SErrorAvg ; Plot( MALRCurve , "MidBand", ParamColor("ColorMB",colorIndigo) , styleDashed|styleNoTitle); Plot( LowerBand , "LowerBand", ParamColor("ColorLo",colorOrange) , styleLine|styleThick|styleNoTitle); Plot( UpperBand , "UpperBand", ParamColor("ColorUp",colorGreen) , styleLine|styleThick|styleNoTitle); Ch = TimeFrameGetPrice("C", in1Minute/60); clr = IIf(Ch[BarCount-2] > Ch[BarCount-1],colorRed,colorLime); Plot(LineArray(0,C[BarCount-1],BarCount-1,C[BarCount-1],15), "", Clr, styleLine|styleNoLabel, Null, Null, 30); PlotText("CMP:" + C[BarCount-1], BarCount+5, C[BarCount-1],colorBlack,Clr); LRPeriods = Param("Length", 40, 3, 200, 1); LRCurve = LinearReg( C, LRPeriods ); PlotLR = IIf(LRCurve < LowerBand, (LRCurve + LowerBand)/2, IIf(LRCurve > UpperBand, (LRCurve + UpperBand)/2, LRCurve)); PlotLR = (PlotLR + SwingLine)/2; bc1 = (Cross(C, MALRCurve) OR Cross(C, UpperBand) OR Cross(C, LowerBand)) AND (C > SwingLine); bc2 = Cross(C, SwingLine) AND (C > MALRCurve OR C > UpperBand OR C > LowerBand); sc1 = (Cross(MALRCurve, C) OR Cross(UpperBand, C) OR Cross(LowerBand, C)) AND (C < SwingLine); sc2 = Cross(SwingLine, C) AND (C < MALRCurve OR C < UpperBand OR C < LowerBand); Buy = bc1 OR bc2; Sell = sc1 OR sc2; Buy = ExRem(Buy, Sell); Sell = ExRem(Sell, Buy); } //PlotDT(); _SECTION_END();