Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Easylanguage Price Series Provider for Commodity Channel Index (CCI)
First and foremost, I appreciate all that look and provide their thoughts/opinions.
I'm trying to convert the Easylanguage Commodity Channel Index (CCI) to be used with a Price Series Provider. I've read a handful of articles on how it's actually calculated: below is from tradingview . com / wiki / Commodity_Channel_Index_(CCI)
"There are several steps involved in calculating the Commodity Channel Index.
The following example is for a typical 20 Period CCI:
CCI = (Typical Price - 20 Period SMA of TP) / (.015 x Mean Deviation)
Typical Price (TP) = (High + Low + Close)/3
Constant = .015
The Constant is set at .015 for scaling purposes.
By including the constant, the majority of CCI values will fall within the 100 to -100 range.
There are three steps to calculating the Mean Deviation.
1. Subtract the most recent 20 Period Simple Moving from each typical price (TP) for the Period.
2. Sum these numbers strictly using absolute values.
3. Divide the value generated in step 3 by the total number of Periods (20 in this case).
When plotting the CCIValue that i have created, it mirrors exactly, the line part only, of the standard CCI on all time frames. what differs is the actual values. for example, the standard CCI would show a value of say -174.99 while my CCIValue would show -3.89 at the 13:00 time in the attachment.
Where i'm stuck (meaning i don't understand how to write it) is on Steps 1 & 2 from what I listed above:
1. Subtract the most recent 20 Period Simple Moving from each typical price (TP) for the Period.
2. Sum these numbers strictly using absolute values.
Would someone mind assisting me in filling in my shortcomings here?
Thank you.
DG
Can you help answer these questions from other members on NexusFi?
I would suggest checking out the values you get using the AverageFC function with your PSP input. This might not work due to the "Limitations of PriceSeriesProviders" and averaging the values within your code might be the way to go.
i appreciate the response...and that's what i ended up doing. So thank you for that guidance. The next piece to my puzzle is getting the Price Series Provider to function based off of the 24hr & Pre/Post market data. currently i can only get my coding to function when im set on "Regular Session". if i flip to a 24hr (or Pre/Post) my data turns to a flat line.