PureBytes Links
Trading Reference Links
|
Hi, you can try this one...
Steve
//Calculate Adaptive Moving Average from Kaufman - KAMA
P = Close;
Periods = Param("Slow Avg Time Periods",20,1,1000,1);
Direction = P - Ref(P,-periods);
Volatility = Sum(abs(P-Ref(P,-1)),periods);
Volatility =IIf(Volatility>0,Volatility,0.00001);
ER = abs(Direction/Volatility);
FastSC = 2/(2 + 1);
SlowSC = 2/(30 + 1);
SSC = ER * (FastSC - SlowSC) + SlowSC;
Constant20 = SSC^2;
KAMA20 = (AMA(P,Constant20));
AddColumn( AMA( P, Constant20), "KAMA20");
P = Close;
Periods2 = Param("Fast Avg Time Periods",10,1,1000,1);
Direction = P - Ref(P,-periods2);
Volatility = Sum(abs(P-Ref(P,-1)),periods2);
Volatility =IIf(Volatility>0,Volatility,0.00001);
ER = abs(Direction/Volatility);
FastSC = 2/(2 + 1);
SlowSC = 2/(30 + 1);
SSC = ER * (FastSC - SlowSC) + SlowSC;
Constant = SSC^2;
KAMA10 = (AMA(P,Constant));
AddColumn( AMA( P, Constant), "KAMA10");
----- Original Message -----
From: "srengret" <lechols@xxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, January 24, 2009 9:45 AM
Subject: [amibroker] Exploration-Two columns display incorrect data - How to
correct?
> In an exploration, I'm using a Kaufman Adaptive Moving Average and
> trying to compare two different time periods - 20 days and 10 days.
> When I use Automatic Analysis and Explore, the two columns display the
> same data on the same date, so I think this is incorrect after
> checking the data on a chart. How can I fix this column data problem?
> It is likely something simple that I overlooked. My code is below:
>
> //Calculate Adaptive Moving Average from Kaufman - KAMA
> P = Close;
> Periods = Param("Time Periods",20,1,1000,1);
>
> Direction = P - Ref(P,-periods);
>
> Volatility = Sum(abs(P-Ref(P,-1)),periods);
>
> Volatility =IIf(Volatility>0,Volatility,0.00001);
>
> ER = abs(Direction/Volatility);
>
> FastSC = 2/(2 + 1);
>
> SlowSC = 2/(30 + 1);
>
> SSC = ER * (FastSC - SlowSC) + SlowSC;
>
> Constant20 = SSC^2;
>
> KAMA20 = (AMA(P,Constant20));
> AddColumn( AMA( P, Constant20), "KAMA20");
>
>
>
> P = Close;
> Periods = Param("Time Periods",10,1,1000,1);
>
> Direction = P - Ref(P,-periods);
>
> Volatility = Sum(abs(P-Ref(P,-1)),periods);
>
> Volatility =IIf(Volatility>0,Volatility,0.00001);
>
> ER = abs(Direction/Volatility);
>
> FastSC = 2/(2 + 1);
>
> SlowSC = 2/(30 + 1);
>
> SSC = ER * (FastSC - SlowSC) + SlowSC;
>
> Constant = SSC^2;
>
> KAMA10 = (AMA(P,Constant));
> AddColumn( AMA( P, Constant), "KAMA10");
>
>
>
>
> ------------------------------------
>
> **** IMPORTANT ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
>
> *********************
> TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
> *********************
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
> *********************************
> Yahoo! Groups Links
>
>
>
>
------------------------------------
**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|