Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
VAR MA Ribbon for Amibroker (AFL)
This is the code for VAR MA transformed from FANTAILVMA3.mq4 file
Screenshots
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 | /// Var MA afl converted from mq4 file /// created by Er. Gagandeep Singh email: bhatiags (at) gmail (dot) com /// This file is under creatives common licence // free to use and distribute, the only condition is to return the file if any modifications/ code changes are done. 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 () ); // Decleration of Parameters Weighting = Param ( "Weighting factor" , 4, 1,15,0.1); adxperiods = Param ( "adxperiods" , 15, 4,80,0.1); Ribbon_min = Param ( "Ribbon Min Period" , 13, 8 , 21, 1); Ribbon_max = Param ( "Ribbon Max Period" , 55, 22 , 255, 1); MA_Type = ParamList ( "Type" , "Simple,Exponential,Double Exponential,Tripple Exponential,Wilders,Weighted" ); RibbonDensity = Param ( "Ribbon Density" , 1, 1, 5,1); // initializations TR=0; STR[0]= H [0] - L [0]; sPDI = sMDI =0; DPDI = DMDI = 0; Hi = H ; Hi1 = Ref ( H ,-1); Lo = L ; Lo1 = Ref ( L ,-1); Close1= Ref ( C ,-1); Bulls = 0.5*( abs (Hi-Hi1)+(Hi-Hi1)); Bears = 0.5*( abs (Lo1-Lo)+(Lo1-Lo)); for ( i = 0; i < BarCount ; i++ ) { if ( Bulls [ i ] > Bears[ i ] ) // CORRECT {Bears [ i ] = 0;} else if (Bears [ i ] > Bulls[ i ] ) // CORRECT {Bulls [ i ] = 0;} else if (Bears [ i ] == Bulls[ i ] ) // CORRECT {Bulls [ i ] = 0; Bears [ i ] = 0; } } sPDI = (Weighting* Ref ( PDI (adxperiods), -1) + Bulls)/(Weighting+1); //ma weighting sMDI = (Weighting* Ref ( MDI (adxperiods), -1) + Bears)/(Weighting+1); //ma weighting TR = Max (Hi-Lo,Hi-Close1); STR = (Weighting* Ref (STR,1) + TR)/(Weighting+1); //ma weighting for ( i = 0; i < BarCount ; i++ ) { if (STR[i]>0 ) { DPDI = sPDI[i]/STR[i]; DMDI = sMDI[i]/STR[i]; } if ((DPDI[i] + DMDI[i]) > 0) DX[i] = abs (DPDI - DMDI)/(DPDI + DMDI); else DX[i] = 0; } // initialization DADX DADX = 0; DADX = (Weighting* Ref (DADX, -1) + DX)/(Weighting+1); //ma weighting //vADX = DADX[i]; // initialization of parameter ADXmin = 0; ADXmax = -100; VarMA[0] = C [0]; ADXmin = Min (ADXmin,DADX); ADXmax = Max (ADXmax,DADX); Diff = ADXmax - ADXmin; for ( i = 1; i < BarCount ; i++ ) { if (Diff[i] > 0) Const[i] = (DADX[i]- ADXmin[i])/Diff[i]; else Const = 0; } VarMA=((2-Const* Ref (VarMA, -1)+Const* Close )); for ( i = Ribbon_min; i<=Ribbon_max;i= i+RibbonDensity) { if ( MA_Type == "Simple" ) Plot ( MA (VarMA,i), "" , ColorHSB ( 3*(i-10), Param ( "Saturation" , 128, 0, 255 ), Param ( "Brightness" , 255, 0, 255 ) ), styleNoLabel , Zorder = -1); else if ( MA_Type == "Exponential" ) Plot ( EMA (VarMA,i), "" , ColorHSB ( 3*(i-10), Param ( "Saturation" , 128, 0, 255 ), Param ( "Brightness" , 255, 0, 255 ) ), styleNoLabel ); else if ( MA_Type == "Double Exponential" ) Plot ( DEMA (VarMA,i), "" , ColorHSB ( 3*(i-10), Param ( "Saturation" , 128, 0, 255 ), Param ( "Brightness" , 255, 0, 255 ) ), styleNoLabel ); else if ( MA_Type == "Tripple Exponential" ) Plot ( TEMA (VarMA,i), "" , ColorHSB ( 3*(i-10), Param ( "Saturation" , 128, 0, 255 ), Param ( "Brightness" , 255, 0, 255 ) ), styleNoLabel ); else if ( MA_Type == "Wilders" ) Plot ( Wilders (VarMA,i), "" , ColorHSB ( 3*(i-10), Param ( "Saturation" , 128, 0, 255 ), Param ( "Brightness" , 255, 0, 255 ) ), styleNoLabel ); else if ( MA_Type == "Weighted" ) Plot ( WMA (VarMA,i), "" , ColorHSB ( 3*(i-10), Param ( "Saturation" , 128, 0, 255 ), Param ( "Brightness" , 255, 0, 255 ) ), styleNoLabel ); } _SECTION_END (); |
2 comments
Leave Comment
Please login here to leave a comment.
Back
Hi
How to use it any trading method based on this will be appreciated.
Thanks
http://www.2shared.com/file/4pEKKpJ4/Trend_trading-part1.html
please read the two pdf files