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 ....
Simple sar system for Amibroker (AFL)
Copy & Paste Friendly
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | _SECTION_BEGIN ( "Price" ); 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" , ParamColor ( "Color" , colorBlack ), styleNoTitle | ParamStyle ( "Style" ) | GetPriceStyle () ); _SECTION_END (); _SECTION_BEGIN ( "SAR" ); acc = Param ( "Acceleration" , 0.1, 0, 1, 0.001 ); accm = Param ( "Max. acceleration" , 0.06, 0, 1, 0.001 ); SAR1 = SAR (acc,accm); Buy1 = Cross ( Open , SAR (acc,accm)); Sell1 = Cross ( SAR (acc,accm), Open ); if ( ParamToggle ( "SAR" , "Show|Hide" ,1)){ Plot (SAR1, "" ,1, styleDots | styleNoLine ); PlotShapes ( IIf (Buy1, shapeUpArrow , shapeNone ), colorYellow , 0, Low , Offset=-15); PlotShapes ( IIf (Buy1, shapeSmallCircle , shapeNone ), colorYellow , 0, Low , Offset=-28); PlotShapes ( IIf (Sell1, shapeDownArrow , shapeNone ), colorWhite , 0, High , Offset=-15); PlotShapes ( IIf (Sell1, shapeSmallCircle , shapeNone ), colorWhite , 0, High , Offset= 28); } _SECTION_END (); messageboard = ParamToggle ( "Message Board" , "Show|Hide" ,0); exitlong = Sell1; PlotShapes (exitlong * shapeDownArrow , colorBlack ,0, H ,-10); exitshort = Buy1; PlotShapes (exitshort * shapeUpArrow , colorBlack ,0, L ,-15); Buy = exitshort; Sell = exitlong; Buy = ExRem ( Buy , Sell ); Sell = ExRem ( Sell , Buy ); AlertIf ( Buy , "" , "BUY @ " + C , 1 ); AlertIf ( Sell , "" , "SELL @ " + C , 2 ); for (i= BarCount -1;i>1;i--) { if ( Buy [i] == 1) { entry = C [i]; sig = "BUY" ; sl = sar1[i]; tar1 = entry + (entry * .0056); tar2 = entry + (entry * .0116); tar3 = entry + (entry * .0216); bars = i; i = 0; } if ( Sell [i] == 1) { sig = "SELL" ; entry = C [i]; sl = SAR1[i]; tar1 = entry - (entry * .0056); tar2 = entry - (entry * .0116); tar3 = entry - (entry * .0216); bars = i; i = 0; } } Offset = 20; Clr = IIf (sig == "BUY" , colorLime , colorRed ); ssl = IIf (bars == BarCount -1, sar1[ BarCount -1], Ref (SAR1, -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), "" , colorDarkRed , styleLine | styleLine , Null , Null , Offset); Plot ( LineArray (bars-Offset, entry, BarCount , entry,1), "" , colorGreen , styleLine | styleLine , Null , Null , Offset); for (i=bars; i < BarCount ;i++) { PlotText ( "" +sig+ "@" +entry, BarCount +1,entry, Null , colorBlue ); PlotText ( "T1@" +tar1, BarCount +3,tar1, Null ,Clr); PlotText ( "T2@" +tar2, BarCount +3,tar2, Null ,Clr); PlotText ( "T3@" +tar3, BarCount +3,tar3, Null ,Clr); } printf ( "Last " + sig + " Signal came " + ( BarCount -bars) + " bars ago" ); printf ( "\n" + sig + " @ : " + entry + "\nStop Loss : " + sl + " (" + WriteVal ( IIf (sig == "SELL" ,entry-sl,sl-entry), 2.2) + ")" + "\nTarget_1 : " + tar1 + "\nTarget_2 : " + tar2 + "\nTarget_3 : " + tar3); printf ( "\nCurrent P/L : " + WriteVal ( IIf (sig == "BUY" ,( C -entry),(entry- C )),2.2)); if (messageboard == 0 ) { GfxSelectFont ( "Tahoma" , 9, 100 ); GfxSetBkMode ( 1 ); GfxSetTextColor ( colorWhite ); if ( sig == "BUY" ) { GfxSelectSolidBrush ( colorBlue ); // this is the box background color } else { GfxSelectSolidBrush ( colorRed ); // this is the box background color } pxHeight = Status ( "pxchartheight" ) ; xx = Status ( "pxchartwidth" ); Left = 1100; width = 310; x = 5; x2 = 210; y = pxHeight; GfxSelectPen ( colorGreen , 1); // broader color GfxRoundRect ( x, y - 163, x2, y , 7, 7 ) ; GfxTextOut ( ( " Message Box " ),88,y-165); GfxTextOut ( ( " " ),27,y-160); GfxTextOut ( ( "Last " + sig + " Signal came " + ( BarCount -bars-1) * Interval ()/60 + " mins ago" ), 13, y-140) ; // The text format location GfxTextOut ( ( "" + WriteIf (sig == "BUY" ,sig + " @ " ,sig + " @" ) + " : " + entry), 13, y-120); GfxTextOut ( ( "Trailing SL : " + sl + " (" + WriteVal ( IIf (sig == "SELL" ,entry-sl,sl-entry), 2.2) + ")" ), 13, y-100); GfxTextOut ( ( "TGT:1 : " + tar1), 13, y -80); GfxTextOut ( ( "TGT:2 : " + tar2), 13,y-60); GfxTextOut ( ( "TGT:3 : " + tar3), 13,y-40); GfxTextOut ( ( "Current P/L : " + WriteVal ( IIf (sig == "BUY" ,( C -entry),(entry- C )),2.2)), 88, y-22);; } _SECTION_BEGIN ( "ADX" ); uptrend= PDI ()> MDI () AND Signal ()< MACD (); downtrend= MDI ()> PDI () AND Signal ()> MACD (); Plot ( 2, "ADX" , IIf ( uptrend, colorGreen , IIf ( downtrend, colorRed , colorBlack )), styleOwnScale | styleArea | styleNoLabel , -0.5, 100 ); _SECTION_END (); GraphXSpace =5; |