Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 1/28/2005 Posts: 6,049
|
I was wondering if a 14 period version of the Choppiness Index
could be created?
This is a description of it:
-------------------------------------------------------------------------
Choppiness = 100.0 * Log(Sum(TrueRange,Period)/(HMax -LMax)) / Log(Period)
-------------------------------------------------------------------------
Calculations:
HMax = MaxList(Max(High, Close[1]), Period)
LMax = MinList(Min(Low, Close[1]), Period)
where:
Close[1] is Close one bar ago,
Max(a,b) is the largest of a and b,
MaxList(a,N) is the largest a in N bars back,
MinList(a,N) is the smallest a in N bars back,
Sum(a,N) is the sum of a over N bars back,
Thanks
diceman
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following:
100 * LOG((14 * (AVGH14 - AVGL14) + ABS(H - C1) + ABS(C1 - L) + ABS(H1 - C2) + ABS(C2 - L1) + ABS(H2 - C3) + ABS(C3 - L2) + ABS(H3 - C4) + ABS(C4 - L3) + ABS(H4 - C5) + ABS(C5 - L4) + ABS(H5 - C6) + ABS(C6 - L5) + ABS(H6 - C7) + ABS(C7 - L6) + ABS(H7 - C8) + ABS(C8 - L7) + ABS(H8 - C9) + ABS(C9 - L8) + ABS(H9 - C10) + ABS(C10 - L9) + ABS(H10 - C11) + ABS(C11 - L10) + ABS(H11 - C12) + ABS(C12 - L11) + ABS(H12 - C13) + ABS(C13 - L12) + ABS(H13 - C14) + ABS(C14 - L13)) / (MAXH14 - MINL14 + ABS(MAXH14 - C14)+ ABS(MINL14 - C14))) / LOG(14)
You may wish to review the following:
How to create a Personal Criteria Forumula (PCF)
Plotting Custom Indicators with Examples
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/28/2005 Posts: 6,049
|
Bruce, in v11, I get :
Error in formula
Argument missing near (
Cant get this to plot.
Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It is a bug in the discontinued TC2000 version 11 beta (it will not be corrected as the TC2000 version 11 beta is unsupported). You can get around it by using TC2000 version 7, TC2000 version 12.1 or by working around the bug.
The part it doesn't seem to like is LOG(14), so if you change this to LOG(14 + 0), it should work.
100 * LOG((14 * (AVGH14 - AVGL14) + ABS(H - C1) + ABS(C1 - L) + ABS(H1 - C2) + ABS(C2 - L1) + ABS(H2 - C3) + ABS(C3 - L2) + ABS(H3 - C4) + ABS(C4 - L3) + ABS(H4 - C5) + ABS(C5 - L4) + ABS(H5 - C6) + ABS(C6 - L5) + ABS(H6 - C7) + ABS(C7 - L6) + ABS(H7 - C8) + ABS(C8 - L7) + ABS(H8 - C9) + ABS(C9 - L8) + ABS(H9 - C10) + ABS(C10 - L9) + ABS(H10 - C11) + ABS(C11 - L10) + ABS(H11 - C12) + ABS(C12 - L11) + ABS(H12 - C13) + ABS(C13 - L12) + ABS(H13 - C14) + ABS(C14 - L13)) / (MAXH14 - MINL14 + ABS(MAXH14 - C14) + ABS(MINL14 - C14))) / LOG(14 + 0)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/29/2010 Posts: 417
|
Bruce,
I tried to shorten the above pcf to create one for 8 periods and keep getting an error.
The 14 period pcf above works great.
My pcf below does not work.
100 * LOG((8 * (AVGH8 - AVGL8) + ABS(H - C1) + ABS(C1 - L) + ABS(H1 - C2) + ABS(C2 - L1) + ABS(H2 - C3) + ABS(C3 - L2) + ABS(H3 - C4) + ABS(C4 - L3) + ABS(H4 - C5) + ABS(C5 - L4) + ABS(H5 - C6) + ABS(C6 - L5) + ABS(H6 - C7) + ABS(C7 - L6) + ABS(H7 - C8) + ABS(C8 - L7)) / (MAXH8 - MINL8 + ABS(MAXH8 - C8) + ABS(MINL8 - C8))) / LOG(8+0)
Please fix this and also provide a pcf for 5 periods.
Thank you,
Don
|
|
Registered User Joined: 7/29/2010 Posts: 417
|
I wanted to continue on this thread even though I am not using v 7 but v 12.5
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
What error are you seeing? I copied and pasted your formula and it worked for me.
|
|
Registered User Joined: 7/29/2010 Posts: 417
|
Thank you Stockguy.
I have gotten the 8 period to work but now am consistently getting a syntax error for the 5 period with this pcf:
100 * LOG((5 * (AVGH5- AVGL5) + ABS(H - C1) + ABS(C1 - L) + ABS(H1 - C2) + ABS(C2 - L1) + ABS(H2 - C3) + ABS(C3 - L2) + ABS(H3 - C4) + ABS(C4 - L3) + ABS(H4 - C5) + ABS(C5 - L4)) / (MAXH5 - MINL5 + ABS(MAXH5 - C5) + ABS(MINL5 - C5))) / LOG(5+0)
Does the above 5 period work for you?
Thank you for your help.
Don
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
I'm not sure what the problem could be. I just copied and pasted into my TC2000 and it worked fine. I tried it in version 12.5 and 17 and both worked.
|
|
Registered User Joined: 7/29/2010 Posts: 417
|
Stockguy,
I tried again with a blank pcf and it now works.
Many thanks,
Don
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
Glad you got it working.
|
|
Registered User Joined: 7/29/2010 Posts: 417
|
Stockguy,
Now same syntax error with 3 period:
100 * LOG((3 * (AVGH3- AVGL3) + ABS(H - C1) + ABS(C1 - L) + ABS(H1 - C2) + ABS(C2 - L1) + ABS(H2 - C3) + ABS(C3 - L2)) / (MAXH3 - MINL3 + ABS(MAXH3 - C3) + ABS(MINL3 - C3))) / LOG(3+0)
I still don't know how to prevent this and cannot get the above to work.
Thank you,
Don
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
Works fine here. Are you typing the formula in TC2000 or pasting it? If copy/paste, paste it into Notepad first, then copy/paste from there. Sometimes copying from Word or other programs will pick up weird characters.
|
|
Registered User Joined: 7/29/2010 Posts: 417
|
I have been copy/pasting directly from Word.
I then tried copy/paste from Word to Notepad to pcf and am still getting syntax error for 3 period pcf.
Very frustrating.
Don
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Don't use Word. You need to use a text editor such as Notepad and not a word processor like Word.
The reason you are copying and pasting into a text editor and then copying and pasting from the text editor into the program is to eliminate any extra formatting introduced by the browser you are using (most frequently a Microsoft product such as IE or Edge) which was not actually part of the formula on the webpage.
Word processors can introduce their own formatting (and at the very least usually try to keep the original formatting from a paste), so you don't want to use a word processor for this.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |