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 ....
Auto Buy Sell With SL 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 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | I found this AFL on other site. I am not the owner of this AFL but found this good and would like to shareit. Unfortunately i dont know who is the owner of this AFL. // Best Amibroker Afl with Buy/Sell Signals - Reg. (AFL) // URL: http://www.traderji.com/software/27917-best-amibroker-afl-buy-sell-signals-reg-7.html // // Extra: KAMAS Buy-Sell for Amibroker (AFL) // 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 ( C < Ref ( Min ( Min ( L , Ref ( L ,-20)), Min ( Ref ( L ,-10), Ref ( L ,-15))),-1), Max ( Max ( H , Ref ( H ,-20)), Max ( Ref ( H ,-10), Ref ( H ,-15))),PREV)); a= Cross ( Close ,d); b= Cross (d, Close ); state= IIf ( BarsSince (a)< BarsSince (b),1,0); s=state> Ref (state,-1); ss=state< Ref (state,-1); sss=state== Ref (state,-1); col= IIf (state == 1 ,51, IIf (state ==0,4,1)); Plot ( C , "" ,Col,64); PlotShapes ( shapeUpArrow * s , colorGreen ,0, L ); PlotShapes ( shapeDownArrow *ss , colorRed ,0, H ); Filter = s OR ss OR sss ; AddColumn ( C , "close" ,1.2); AddColumn ( IIf ( s, 66,1 ), "buy" , formatChar, 1, bkcolor = IIf (s, colorYellow , colorPink )); AddColumn ( IIf ( Ss, 83,1 ), "sell" , formatChar, 1, bkcolor = IIf (Ss, colorPink , colorYellow )); AddColumn ( IIf ( sss, 87,1 ), "wait" , formatChar, 1, bkcolor = IIf (sss, colorYellow , colorRed )); _SECTION_BEGIN ( "Buy/Sell Signals" ); _N (Title = EncodeColor ( colorWhite ) + "{{NAME}} - {{INTERVAL}} {{DATE}}: " + _DEFAULT_NAME ()+ " : {{OHLCX}} {{VALUES}}" + "\n" + EncodeColor ( colorYellow )+ WriteIf (s, "EXIT all Short positions\nif trading long positions, enter long Now-\nOR at the market price on tomorrow's Open with stop=" + EncodeColor (4)+ WriteVal ( L +.75* ATR (5),1.4)+ " ," , "" )+ WriteIf (ss, "Exit all long positions today with a Market On Close (MOC) order\nOR at the market price on tomorrow's Open with stop=" + EncodeColor (4)+ WriteVal ( Ref ( H +.75* ATR (5), -1),1.4)+ "," , "" )+ WriteIf ( sss , "No trading signals today." , "" ) ); _SECTION_END (); _SECTION_BEGIN ( "Buy Sell Arrow Signals" ); Buy = s; Sell = ss; PlotShapes ( IIf ( Buy , shapeSquare , shapeNone ), colorGreen , 0, L , Offset=-30); PlotShapes ( IIf ( Buy , shapeSquare , shapeNone ), colorLime , 0, L , Offset=-40); PlotShapes ( IIf ( Buy , shapeUpArrow , shapeNone ), colorWhite , 0, L , Offset=-35); PlotShapes ( IIf ( Sell , shapeSquare , shapeNone ), colorRed , 0, H , Offset=30); PlotShapes ( IIf ( Sell , shapeSquare , shapeNone ), colorOrange , 0, H , Offset=40); PlotShapes ( IIf ( Sell , shapeDownArrow , shapeNone ), colorWhite , 0, H , Offset=-35); dist = 2* ATR (20); //0.8 dist1 = 2* ATR (20); //1.2 for ( i = 0; i < BarCount ; i++ ) { if ( Buy [i] ) { PlotText ( "\nBuy:" + L [ i ] + "\nT= " + ( L [i]*1.005) + "\nSL= " + ( L [i]*0.9975), i, L [ i ]-dist[i], colorLightBlue ); } if ( Sell [i] ) { PlotText ( "Sell:" + H [ i ] + "\nT= " + ( H [i]*0.995) + "\nSL= " + ( H [i]*1.0025), i, H [ i ]+dist1[i], colorLightBlue ); } } _SECTION_END (); _SECTION_BEGIN ( "Swing" ); no=20; 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); supres= IIf (avn==1,sup,res); a= Cross ( C ,supres); b= Cross (supres, C ); style = a * styleStaircase + b * styleStaircase ; PlotShapes (a,style, IIf (a, colorGreen , colorRed ), 0, IIf (a, Low , High )); _SECTION_END (); _SECTION_BEGIN ( "Trend" ); uptrend= PDI (20)> MDI (10) AND Signal (29)< MACD (13); downtrend= MDI (10)> PDI (20) AND Signal (29)> MACD (13); Plot ( 2, /* defines the height of the ribbon in percent of pane width */ "ribbon" , IIf ( uptrend, colorGreen , IIf ( downtrend, colorRed , 0 )), /* choose color */ styleOwnScale | styleArea | styleNoLabel , -0.5, 100 ); _SECTION_END (); //d = Close > Ref( ChandelierHL(ATR(3),20), -1); //e =Close < Ref( ChandelierHL(ATR(3),20), -1); //f = Close < Ref( ChandelierHL(ATR(3),20), -1); //g = Close > Ref( ChandelierHL(ATR(3),20), -1); Buy = s AND a AND uptrend ; Short = ss AND b AND downtrend ; Sell = ss AND b AND downtrend ; Cover = s AND a AND uptrend ; Buy = ExRem ( Buy , Sell ); Sell = ExRem ( Sell , Buy ); Cover = ExRem ( Cover , Short ); Short = ExRem ( Short , Cover ); Filter = Buy OR Sell ; Filter = Cover OR Short ; AddColumn ( Buy , "Buy" , 1); AddColumn ( Sell , "Sell" , 1); AddColumn ( Close , "Close" ,1.2); AddColumn ( Volume , "Volume" ,1.0); _SECTION_BEGIN ( "Volume" ); Plot ( Volume , _DEFAULT_NAME (), ParamColor ( "Color" , ColorRGB (20,20,20) ), styleNoTitle | ParamStyle ( "Style" , styleHistogram | styleOwnScale | styleThick | styleNoLabel , maskHistogram ), 2 ); _SECTION_END (); // Plot the Buy and Sell arrows. shape = Buy * shapeUpArrow + Sell * shapeDownArrow ; PlotShapes (shape, IIf ( Buy , colorGreen , colorRed ), 0, IIf ( Buy , Low , High )); Plot (supres, "Swing" , colorYellow , styleStaircase ); //SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )), //ParamColor("BgBottom", ColorRGB( 172,172,172 )),ParamColor("titleblock",ColorRGB( 172,172,172 ))); //Alerts AlertIf ( Buy , "SOUND C:\\Windows\\Media\\tada.wav" , "Buy" ,2); AlertIf ( Short , "SOUND C:\\Windows\\Media\\notify.wav" , "Short" , 2 ); GraphXSpace = 5; /* -------------------------------------------------------------------------------------- */ SetChartBkColor ( colorBlack ); SetChartOptions (0, chartShowArrows | chartShowDates ); _SECTION_BEGIN ( "MA1" ); P = ParamField ( "Price field" ,-1); Periods = Param ( "Periods" , 15, 2, 300, 1, 10 ); Plot ( MA ( P, Periods ), _DEFAULT_NAME (), ParamColor ( "Color" , colorCycle ), ParamStyle ( "Style" ) ); _SECTION_END (); _SECTION_BEGIN ( "MA3" ); P = ParamField ( "Price field" ,-1); Periods = Param ( "Periods" , 15, 2, 300, 1, 10 ); Plot ( MA ( P, Periods ), _DEFAULT_NAME (), ParamColor ( "Color" , colorCycle ), ParamStyle ( "Style" ) ); _SECTION_END (); /* -------------------------------------------------------------------------------------- */ //KAMAS Buy-Sell for Amibroker (AFL) _SECTION_BEGIN ( "KAMA System 1.0" ); //SetChartOptions(0,chartShowArrows|chartShowDates); //Title = ("KAMA SYSTEM - " + Name()+" " + Date() +" "+Interval(2) +" "+ EncodeColor(colorLime)+",Open "+Open +" ,High "+H+" ,Low "+L+" ,Close "+C+" "+"{{VALUES}}"); //{{VALUES}}"+ O+ H+ L+C); //_N(Title =StrFormat("{{Name}} - {{Interval}} {{Date}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )); // Buy adjustments bs= Param ( "BUY Sensitivity" ,7,2,20,1); bf= Param ( "BUY Finetune" ,2,0.1,20,0.1); ///uncommentf for optimization //bs=Optimize("BUY Sensitivity",7,2,20,1); //bf=Optimize("BUY Finetune",2,0.1,20,0.1); // Sell Adjustments ss= Param ( "SELL Sensitivity" ,5,2,20,1); sf= Param ( "SELL Finetune" ,1,0.1,20,0.1); ///uncommentf for optimization ss= Optimize ( "SELL Sensitivity" ,5,2,20,1); sf= Optimize ( "SELL Finetune" ,1,0.1,20,0.1); //stock selection parameters MyCL = Param ( "CL" , 10, 10, 100, 10 ); MyVK = Param ( "VK" , 30, 10, 100, 10 ); MyTL = Param ( "TL" , 300, 100, 1000, 100 ); //stock selection //TLM = EMA(C*V/100000,100) ; //include = C> MyCL AND V/1000> MyVK AND C*V/100000 > MyTL AND TLM > 0.333 * MyTL ; // common fast = 2/(2+1); slow = 2/(30+1); //BUY part dirb= abs ( Close - Ref ( Close ,-bs)); volb= Sum ( abs ( Close - Ref ( Close ,-1)),bs); ERb=dirb/volb; scb =( ERb*(fast-slow)+slow)^2; xb = AMA ( C , scb ); flb=bf* StDev (xb- Ref (xb,-1),20); j=xb- Ref (xb,-3); //SELL part dirs= abs ( Close - Ref ( Close ,-ss)); vols= Sum ( abs ( Close - Ref ( Close ,-1)),ss); ERs=dirs/vols; scs =( ERs*(fast-slow)+slow)^2; xs = AMA ( C , scs ); fls=sf* StDev (xs- Ref (xs,-1),20); k= Ref (Xs,-3)-Xs; Buy = Cross (j,flb) ; Sell = Cross (k,fls); mycolor= IIf ( C >xb, colorLime , colorRed ); //Plot( C, "Close", mycolor,styleNoTitle | styleCandle ); //Plot(xb,"KAMA-BUY",colorRed,1); //Plot(xs,"KAMA-SELL",colorOrange,1); Buy = ExRem ( Buy , Sell ); Sell = ExRem ( Sell , Buy ); shape = Buy * shapeHollowUpArrow + Sell * shapeHollowDownArrow ; PlotShapes ( shape, IIf ( Buy , colorYellow , colorYellow ),0, IIf ( Buy , Low , High ) ); //SetChartBkColor(colorBlack); //GraphXSpace = 5; dist = 2* ATR (20); //0.8 dist1 = 2* ATR (20); //1.2 for ( i = 0; i < BarCount ; i++ ) { if ( Buy [i] ) PlotText ( "Buy@" + C [ i ], i, L [ i ]-dist[i], colorYellow ); if ( Sell [i] ) PlotText ( "Sell@" + C [ i ], i, L [ i ]+dist1[i], colorYellow ); } Filter = Buy OR Sell ; PositionScore=100/ C ; PositionSize = - 20; SetBarsRequired (10000, 10000); SetFormulaName ( "KAMA System" ); _SECTION_END (); /* -------------------------------------------------------------------------------------- */ _SECTION_BEGIN ( "Show Values at H&L" ); n= Param ( "Values back" ,20,1,200,1); p= Param ( "zig %" ,5,1,100,1); dist = 1.5* ATR (15); //0.8 15 for ( i = 1; i < n; i++ ) { PlotText ( "" + LastValue ( Peak ( H ,p,i), True ), BarCount -2- LastValue ( PeakBars ( H ,p,i)), LastValue (dist, True )+ LastValue ( Peak ( H ,p,i), False ), colorGreen ); //colorWhite,colorDarkGreen PlotText ( "" + LastValue ( Trough ( L ,p,i), True ), BarCount -2- LastValue ( TroughBars ( L ,p,i)), LastValue ( Trough ( L ,p,i), False )- LastValue (dist, True ), colorRed ); //colorWhite,colorDarkRed } _SECTION_END (); /* -------------------------------------------------------------------------------------- */ _SECTION_BEGIN ( "Name" ); GfxSetOverlayMode (1); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/8 ); GfxSetTextAlign ( 6 ); // center alignment GfxSetTextColor ( ColorHSB ( 42, 42, 42 ) ); GfxSetBkMode (0); // transparent GfxTextOut ( Name (), Status ( "pxwidth" )/2, Status ( "pxheight" )/12 ); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/18 ); GfxTextOut ( IndustryID (1), Status ( "pxwidth" )/2, Status ( "pxheight" )/4 ); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/18 ); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/36 ); GfxTextOut ( "Buy/Sell Signals" , Status ( "pxwidth" )/2, Status ( "pxheight" )/3 ); _SECTION_END (); /* -------------------------------------------------------------------------------------- */ SetChartBkColor ( ParamColor ( "Outer panel color " , colorBlack )); // color of outer border SetChartBkGradientFill ( ParamColor ( "Inner panel color upper half" , colorBlack ), ParamColor ( "Inner panel color lower half" , colorBlack )); // color of inner panel _SECTION_BEGIN ( "Elder Impulse" ); /************************************************************************** Name : Elder Impulse Indicator Coded by : Lal Date : 28.10.2005 Note : Please refer to Elder's "Come Into my Trading Room" for full details Update : 19.Jan.2006 Added Option to allow bars to be Colored as per Impulse Added explorer section to display Impulse Status along with Weekly AND Monthly Trends. 20. Jan.2006 Added ability to flexibly locate Weekly and Monthly Ribbons 9.Feb.2006 Added option for use of TEMA and JMA Added option to allow standard MACD params ******************************************************************************/ EnableTextOutput ( False ); // User-defined parameter for EMA periods EMA_Type = Param ( "EMA-1, TEMA-2, JMA-3" , 2, 1, 3, 1); EMA_prds = Param ( "EMA_periods" , 7, 1, 30, 1); Std_MACD = Param ( "Standard MACD? No-0, Yes-1" , 1, 0, 1, 1); Plot_fashion = Param ( "Bar+Arrows-1, Impulse Bars-2" , 2, 1, 2, 1); // Allow user to define Weekly and Monthly Ribbon Location and Height WR_P1 = Param ( "Weekly Ribbon Location" , -10.5, -1000, 1000, 0.1); WR_P2 = Param ( "Weekly Ribbon Height" , 366.5, -0.001, 500, 0.1); MR_P1 = Param ( "Monthly Ribbon Location" , 5.2, -1000, 1000, 0.1); MR_P2 = Param ( "Monthly Ribbon Height" , 199, -0.001, 500, 0.1); // Compute EMA and MACD Histogram if (EMA_Type == 1) { DayEMA = EMA ( Close , EMA_prds); } if (EMA_Type == 2) { DayEMA = TEMA ( Close , EMA_prds); } if (EMA_Type == 3) { // Line below to be used with Jurik JMA // DayEMA = JurikJMA(C, EMA_Prds); } Histogram = MACD () - Signal (); // Determine if we have an Impulse UP, DOWN or None Impulse_Up = DayEMA > Ref (DayEMA, -1) AND Histogram > Ref (Histogram, -1); Impulse_Down = DayEMA < Ref (DayEMA, -1) AND Histogram < Ref (Histogram, -1); Impulse_None = ( NOT Impulse_UP) AND ( NOT Impulse_Down); // Compute Weekly MACD and determine whether rising or falling // Note: uses "non-standard" parameters! TimeFrameSet ( inWeekly ); if (Std_MACD == 0) { MACD_val = MACD (5, 8); Signal_val = Signal (5, 8, 5); } else { MACD_val = MACD (12, 26); Signal_val = Signal (12, 26, 9); } Hist_in_w = MACD_val - Signal_val; wh_rising = Hist_in_w > Ref (Hist_in_w, -1); wh_falling = Hist_in_w < Ref (Hist_in_w, -1); TimeFrameRestore (); // Now get Monthly MACD Histogram.... TimeFrameSet ( inMonthly ); MACD_val = MACD (5, 8); Signal_val = Signal (5, 8, 5); Hist_in_m = MACD_val - Signal_val; mh_rising = Hist_in_m > Ref (Hist_in_m, -1); mh_falling = Hist_in_m < Ref (Hist_in_m, -1); TimeFrameRestore (); wh_rising = TimeFrameExpand ( wh_rising, inWeekly , expandLast ); wh_falling = TimeFrameExpand ( wh_falling, inWeekly , expandLast); mh_rising = TimeFrameExpand (mh_rising, inMonthly , expandLast); mh_falling = TimeFrameExpand (mh_falling, inMonthly , expandLast); kol = IIf ( wh_rising, colorGreen , IIf (wh_falling, colorRed , colorLightGrey )); mkol = IIf ( mh_rising, colorBlue , IIf (mh_falling, colorYellow , colorLightGrey )); // Plot them all! if (Plot_fashion == 1) { Plot ( Close , "Close" , colorTeal , styleBar ); PlotShapes ( shapeUpArrow * Impulse_Up, colorBlue , 0, Low , -12); PlotShapes ( shapeDownArrow * Impulse_Down, colorRed , 0, High , -12); PlotShapes ( shapeSmallCircle * Impulse_None, colorWhite , 0, High , 5); } else { bar_kol = IIf (impulse_UP, colorBlue , IIf (impulse_Down, colorRed , colorWhite )); Plot ( C , "Close" , bar_kol, styleBar ); } Plot (10, "ribbon" , kol, styleOwnScale | styleArea | styleNoLabel , WR_P1, WR_P2); //Weekly trend Plot (10, "ribbon" , mkol, styleOwnScale | styleArea | styleNoLabel , MR_P1, MR_P2); // Monthly Trend // Explorer Section // Determine if Impulse status is bullish, neutral or bearish. Display as Text Column. Impulse_State = WriteIf (Impulse_Up, "Bulllish" , WriteIf (Impulse_Down, "Bearish" , "Neutral" )); // Set the background color for Impulse Status Column Impulse_Col = IIf (Impulse_Up, colorGreen , IIf (Impulse_Down, colorRed , colorLightGrey )); // Determine Weekly Trend. Display as Text Column Weekly_Trend = WriteIf (wh_rising, "Rising" , WriteIf (wh_falling, "Falling" , "Flat!" )); Weekly_Col = IIf (wh_rising, colorGreen , IIf (wh_falling, colorRed , colorLightGrey )); // Determine Monthly Trend. Display as Text Column Monthly_Trend = WriteIf (mh_rising, "Rising" , WriteIf (mh_falling, "Falling" , "Flat!" )); Monthly_Col = IIf (mh_rising, colorGreen , IIf (mh_falling, colorRed , colorLightGrey )); // Determine how many bars has the current state existed bars_in_bull = Min ( BarsSince (impulse_none), BarsSince (impulse_down)); bars_in_bear = Min ( BarsSince (impulse_up), BarsSince (impulse_none)); bars_in_neut = Min ( BarsSince (impulse_down), BarsSince (impulse_up)); // Set a single variable to show number of bars in current state depending upon // actual Impulse Status - Bullish, Bearish or Neutral bars_in_state = IIf (Impulse_Up, bars_in_bull, IIf (Impulse_down, bars_in_bear, bars_in_neut)); // Columns for display in Explorer AddTextColumn (Impulse_State, "Impulse Status" , 1, colorWhite , Impulse_Col); AddColumn (bars_in_state, "Bars in this state" , 1, colorWhite , Impulse_col); AddTextColumn (Weekly_Trend, "Weekly Trend" , 1, colorWhite , Weekly_Col); AddTextColumn (Monthly_Trend, "Monthly Trend" , 1, colorWhite , Monthly_Col); Filter = 1; _SECTION_END (); |