[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MACD Formula Was: [amibroker] Loss of Gradient in Export



PureBytes Links

Trading Reference Links

Marshall:
 
Here is the code, modified somewhat because I cut and pasted to eliminate
some internal comments and other stuff that is not relevant to the
conference.  However, I have checked this modified code and it does plot
without error.
 
Ken
 
// Calculates and plots the RUTTR MACD (actually any symbol)

 

shortma = Param("Shortma",45,30,60,1);

longma = Param("LongMA",90,60,120,1);

signalma = Param("SignalMA",8,3,16,1); ;

// Symbol = Input your symbol here

// Array = Foreign(Symbol,"C"); // Use when you do not want the MACD to
change

Array = C;

Symbol = Name();//This added to allow Title statement to work. Delete if
using Foreign symbol.

function MACDHistogram(Array, Shortma, LongMa, Signalma)

{

MACDLine = EMA(Array, shortma) - EMA(Array, longma);

signalline = EMA(MACDLine, signalma);

macdhisto = (MACDLine - signalline);

return(MACDhisto);

}

MACDHisto = MACDHistogram(Array, Shortma, LongMa, Signalma);

Color = IIf(MACDHisto>0,colorGreen,colorRed);

Color2 = LastValue(SelectedValue(Color));

Plot(MACDHisto,"MACDHisto
"+Shortma+"/"+Longma+"/"+Signalma,Color,styleHistogram);

Plot(MACDHisto,"",colorWhite,styleLine);

Title = EncodeColor(colorDefault) + Date() + EncodeColor(colorDefault) + "
Symbol = " 

+ Symbol + EncodeColor(color2) + " MACD ["

+ Shortma + "/" + Longma+"/" + Signalma

+ "] = " + EncodeColor(color2) + WriteVal(MACDHisto,1.2) ; 

Up=Cross(MACDHisto,0);

Dn=Cross(0,MACDHisto);

PlotShapes(Up*shapeUpArrow,5);

PlotShapes(Dn*shapeDownArrow,4);


  _____  

From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of M. Smith
Sent: Thursday, January 04, 2007 2:06 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Loss of Gradient in Export


Ken, What is your formula for this MACD? It is very clear.  Thanks Marshall

----- Original Message ----- 
From: Ken Close <mailto:ken45140@xxxxxxxxx>  
To: amibroker@xxxxxxxxxxxxxxx 
Sent: Thursday, January 04, 2007 8:45 AM
Subject: [amibroker] Loss of Gradient in Export



Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.5/616 - Release Date: 1/4/2007 1:34 PM