I see the problem is the built-in MACD works on the price and you need
it to work on your X value so you have to do your own MACD as follows:
X = RelStrength( "$NDX" );
fast = Param("Fast period",12,2,100,1);
slow = Param("Slow period",26,2,100,1);
period = Param("Signal period",9,2,100,1);
MACD_X = EMA(X, fast) - EMA(X, slow);
MACD_X_Signal = EMA(MACD_X, period);
MACD_X_Histogram = MACD_X - MACD_X_Signal;
Plot(MACD_X,"MACD of RSI",1);
Plot(MACD_X_Signal,"Signal Line",2);
Plot(MACD_X_Histogram,"MACD
Histogram",3,styleHistogram|styleOwnScale);
References:
http://www.linnsoft.com/tour/techind/macd.htm
http://www.stockcharts.com/education/IndicatorAnalysis/indic_MACD1.html
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of
cstrader
Sent: Monday, January 02, 2006 20:51
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Re: Referencing to other indicator
Setforeign takes a ticker (e.g. "GC") and not a variable
(e.g. "X").
----- Original Message -----
From: "axium102" <axium102@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, January 02, 2006 10:45 PM
Subject: [amibroker] Re: Referencing to other indicator
> Thanks for all of the suggestions, but I can not getting it to
work
> I tried this:
>
>
> _SECTION_BEGIN("MACD");
> X= RelStrength( "GC" );
>
> SetForeign( "X" );
>
> r1 = Param( "Fast avg", 12, 2, 200, 1 );
> r2 = Param( "Slow avg", 26, 2, 200, 1 );
> r3 = Param( "Signal avg", 9, 2, 200, 1 );
> Plot( ml = MACD(r1, r2),
StrFormat(_SECTION_NAME()+"(%g,%g)", r1,
> r2), ParamColor("MACD color", colorRed ),
ParamStyle("MACD style") );
> Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(),
ParamColor
> ("Signal color", colorBlue ), ParamStyle("Signal
style") );
> Plot( ml-sl, "MACD Histogram",
ParamColor("Histogram color",
> colorBlack ), styleNoTitle | ParamStyle("Histogram style",
> styleHistogram | styleNoLabel, maskHistogram ) );
>
> RestorePriceArrays();
> _SECTION_END();
>
> - But all I am getting is the MACD of the price array insted of
the
> MACD of the relative performance indicator.
>
> Any suggestions ?
>
> Andrew
>
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "axium102"
<axium102@xxxx> wrote:
>>
>> Hello;
>>
>> I am looking for an example of a formula that would plot an
> indicator
>> from an indicator.
>>
>> Precisely I am trying to plot an MACD indicator from a
relative
>> performance inicator such as this:
>>
>> _SECTION_BEGIN("Relative Performance_Gold");
>> X= RelStrength( "GC" );
>> Plot(X,"RelStrength",1,1);
>> _SECTION_END();
>>
>> This indicator plots how a security performs relative to gold.
I
>> would like to plot an MACD indicator of that relative
performance
>> plot.
>>
>> Can please someone help ?
>>
>> Alternatively if anybody has something that is close to this -
> please
>> post it so that I can try to modify it.
>>
>> Thanks
>>
>>
>> Andrew
>>
>
>
>
>
>
>
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor
--------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/