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 ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

VAR MA Ribbon for Amibroker (AFL)

Rating:
3 / 5 (Votes 2)
Tags:
ribbon, amibroker

This is the code for VAR MA transformed from FANTAILVMA3.mq4 file

Screenshots

Similar Indicators / Formulas

H-L Ribbon
Submitted by halfman over 13 years ago
11 Ribbons
Submitted by morgen over 12 years ago
7 ribbons 3
Submitted by k.raaja over 14 years ago
Candle Ribbon
Submitted by brevco over 14 years ago
ADX PDI MDI + ADX Ribbon
Submitted by rattanasak about 11 years ago
Volume Price Analysis (v2 Fix)
Submitted by northstar over 12 years ago

Indicator / Formula

Copy & Paste Friendly
/// 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

1. sikandar

Hi
How to use it any trading method based on this will be appreciated.
Thanks

2. alliswell

http://www.2shared.com/file/4pEKKpJ4/Trend_trading-part1.html

please read the two pdf files

Leave Comment

Please login here to leave a comment.

Back