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

Re: [amibroker] Trying to code the CCI(20)



PureBytes Links

Trading Reference Links

without going into too much on this, have you checkedthe AFL library
and previous posts to this group for CCI?

One thing I will point to is a simplifiaction of what you have 
TP is Avg in AB

TPMA=MA(Avg,20) ; 
ConditionA=Avg-TPMA ; 

//Subtract today's TPMA from TP for each of the last 20 days.
//Sum the absolute values AND divide by 20.
//Multiply the result by 0.015.
simplified to (saves any possible errors creeping in from so many ref's

ConditionB = ABS( Sum( Avg, 20 ) - 20 * TPMA ) / 20 * 0.015;


As to whether this owrks or not ??

On 6/20/05, Gerard Carey <gcfinance@xxxxxxxxxxx> wrote:
> I'd appreciate some help in coding the CCI(20) as I wish to customise
> the indicator.
> I'm using the following description from Incredible Charts but my
> efforts are to no avail.
> 
> // Calculate Typical Price ("TP") ie. (High + Low + Close) / 3
> //Calculate TPMA: a 20-Day simple MA of TP.
> // Subtract TPMA from TP
> 
> //Divide the result by the following:
> 
> //Subtract today's TPMA from TP for each of the last 20 days.
> //Sum the absolute values AND divide by 20.
> //Multiply the result by 0.015.
> 
> // HERE IS MY ATTEMPT
> TP=(H+L+C)/3 ;  // Calculate Typical Price
> TPMA=MA(TP,20) ; // Calculate TPMA: a 20-Day simple MA of TP.
> ConditionA=TP-TPMA ; // Subtract TPMA from TP
> 
> //Divide the result by the following:
> 
> // Subtract TODAY'S TPMA from TP for each of the last 20 days, sum the
> absolute values AND divide by 20.
> ConditionB=( TP-TPMA + Ref(TP,-1)-TPMA + Ref(TP,-2)-TPMA +
> Ref(TP,-3)-TPMA + Ref(TP,-4)-TPMA
> + Ref(TP,-5)-TPMA + Ref(TP,-6)-TPMA + Ref(TP,-7)-TPMA + Ref(TP,-8)-TPMA
> + Ref(TP,-9)-TPMA
> + Ref(TP,-10)-TPMA + Ref(TP,-11)-TPMA + Ref(TP,-12)-TPMA +
> Ref(TP,-13)-TPMA + Ref(TP,-14)-TPMA
> + Ref(TP,-15)-TPMA + Ref(TP,-16)-TPMA + Ref(TP,-17)-TPMA +
> Ref(TP,-18)-TPMA + Ref(TP,-19)-TPMA )/20 ;
> 
> ConditionC=ConditionB*0.015; //Multiply the result by 0.015
> 
> Plot(ConditionA/ConditionC,"",4); // The Division and Plot
> 
> TIA
> Gerard
> 
> --
> http://www.fastmail.fm - Choose from over 50 domains or use your own
> 
> 
> 
> 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
> 
> 
> 
> 
> 
> 
> 


-- 
Cheers
Graham
http://e-wire.net.au/~eb_kavan/


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/