Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Multi frame SAR for Amibroker (AFL)
Multi Frame SAR System using multiple time frame and SAR
Similar Indicators / Formulas
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 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 | _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 ( "Multi frame sar" ); Offset=10; Filter =1; NumColumns=4; function MySAR() { IAF = Param ( "sarIAF" ,0.1,0.01,1,0.01); // acceleration factor MaxAF = Param ( "sarMaxAF" ,0.25,0.01,1.5,0.01); // max acceleration ASAR = Param ( "ASAR" , -1, -50, 1000, 1 ); psar = Close ; // initialize long = 1; // assume long for initial conditions af = IAF; // init acelleration factor ep = Low [ 0 ]; // init extreme point hp = High [ 0 ]; lp = Low [ 0 ]; for ( i = 2; i < BarCount ; i++ ) { if ( long ) { psar [ i ] = psar [ i-1 ] + af * ( hp - psar [ i-1 ] ); } else { psar [ i ] = psar [ i-1 ] + af * ( lp - psar [ i-1 ] ); } reverse = 0; //check for reversal if ( long ) { if ( Low [ i ] < psar [ i ] ) { long = 0; reverse = 1; // reverse position to Short psar [ i ] = hp; // SAR is High point in prev trade lp = Low [ i ]; af = IAF; } } else { if ( High [ i ] > psar [ i ] ) { long = 1; reverse = 1; //reverse position to long psar [ i ] = lp; hp = High [ i ]; af = IAF; } } if ( reverse == 0 ) { if ( long ) { if ( High [ i ] > hp ) { hp = High [ i ]; af = af + IAF; if ( af > MaxAF ) af = MaxAF; } if ( Low [ i - 1 ] < psar[ i ] ) psar[ i ] = Low [ i - 1 ]; if ( Low [ i - 2 ] < psar[ i ] ) psar[ i ] = Low [ i - 2 ]; } else { if ( Low [ i ] < lp ) { lp = Low [ i ]; af = af + IAF; if ( af > MaxAF ) af = MaxAF; } if ( High [ i - 1 ] > psar[ i ] ) psar[ i ] = High [ i - 1 ]; if ( High [ i - 2 ] > psar[ i ] ) psar[ i ] = High [ i - 2 ]; } } } Plot (0, "Null" , colorYellow , styleLine | styleNoLabel ); xxxx= SAR (IAF,MaxAF)> Ref ( C ,-ASAR); //trabajando con close de candela anterior yyyy= Ref ( C ,-ASAR)> SAR (IAF,MaxAF) ; SAREVENTO2=( IIf (yyyy,1, IIf (xxxx,0,1))); return (SAREVENTO2); } function DrawSAR(style) { Offset=Offset+10; if (style == 0) { style= in1Minute ; } TimeFrameSet (style); SAREVENTO2= TimeFrameExpand (MySAR(),style); PlotShapes ( IIf (SAREVENTO2<=1,14,0) , IIf (SAREVENTO2==0, colorWhite , colorGreen ) , 0, 1, Offset); PlotShapes ( IIf (SAREVENTO2==0,13,0) , IIf (SAREVENTO2==1, colorWhite , colorRed ), 0, 1, Offset*-1); TimeFrameRestore (); } Offset=0; //DrawSAR(in1Minute); DrawSAR(2* in5Minute ); DrawSAR(2* in15Minute ); DrawSAR( inHourly ); DrawSAR( inDaily ); //DrawSAR(inWeekly); //DrawSAR(inMonthly); GraphXSpace = 40; _SECTION_END (); |
0 comments
Leave Comment
Please login here to leave a comment.
Back