Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Trend Following System for Amibroker (AFL)
This is a simple long only trend following system. Just load it into the “Automatic Analysis” window and push “Scan”, “Back test” and “Report” to view the result.
By marcus – marcusdavidsson
Indicator / Formula
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 | SetTradeDelays (0,0,0,0); SetPositionSize (10, spsPercentOfEquity ); SetOption ( "AllowSameBarExit" , True ); // If this option is not set true positions that are exited at the same bar remains Open SetOption ( "PriceBoundChecking" , False ); // This option must be set false in order to exit at specified stop price and NOT bar Close //LK=Optimize("Trend", 50, 30, 60, 10 ) ; //FF=Optimize("Trend", 20, 10, 40, 10 ) ; //StopLevel=Optimize("Stop",0.1,0.05,0.5,0.05 ) ; StopLevel = 0.2; LK=50; FF=10; A1= IIf ( L > Ref ( HHV ( Close ,LK),-5), 1, 0); A2= Sum ( A1, LK ) ; A3= IIf ( C >0, FF, 0); Buy = Cross (A2,A3); Sell = 0; trailARRAY = Null ; trailstop = 0; for ( i = 1; i < BarCount ; i++ ) { if ( trailstop == 0 AND Buy [ i ] ) { trailstop = High [ i ] * (1-stoplevel); } else Buy [ i ] = 0; // remove excess buy signals if ( trailstop > 0 ) { trailstop = Max ( High [ i ] * (1-stoplevel), trailstop ); trailARRAY[ i ] = trailstop; } if ( trailstop > 0 AND Low [ i ] < trailstop ) { Sell [ i ] = 1; SellPrice [ i ] = trailstop; trailstop=0; } } PlotShapes ( Buy * shapeUpArrow , colorBlue ,0, Low ); PlotShapes ( Sell * shapeDownArrow , colorRed ,0, High ); Plot ( Close , "Price" , colorBlack , styleBar ); Plot ( trailARRAY, "trailing stop level" , colorRed ); |
0 comments
Leave Comment
Please login here to leave a comment.
Back