NexusFi: Find Your Edge


Home Menu

 





Easylanguage Price Series Provider for Commodity Channel Index (CCI)


Discussion in EasyLanguage Programming

Updated
    1. trending_up 2,573 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 1 attachments




 
Search this Thread

Easylanguage Price Series Provider for Commodity Channel Index (CCI)

  #1 (permalink)
DirtyGoats
Lakeville
 
Posts: 11 since Dec 2017
Thanks Given: 3
Thanks Received: 1

Evening All.

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).



Where i'm currently at is here:

variables:
TP (0),
AvgFC( 0 ),
CCIValue( 0 ) ;


TP = (PSP.Low[0] + PSP.High[0] + PSP.Close[0])/3;
TPlast = TP;

AvgFC = AverageFC( psp.close, 14 );

CCIValue = (TP - AvgFC) / (.015 * 14) ;


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

Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	236
Size:	16.7 KB
ID:	249890  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628


DirtyGoats,

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.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
DirtyGoats
Lakeville
 
Posts: 11 since Dec 2017
Thanks Given: 3
Thanks Received: 1

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.

any recommendations there?

thank you.

DG

Reply With Quote
  #5 (permalink)
DirtyGoats
Lakeville
 
Posts: 11 since Dec 2017
Thanks Given: 3
Thanks Received: 1

nevermind...just found it: PriceSeriesProvide1.SessionName = "24 Hour";

Reply With Quote
Thanked by:
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

DirtyGoats,

thank you for the update.

Regards,

ABCTG


DirtyGoats View Post
nevermind...just found it: PriceSeriesProvide1.SessionName = "24 Hour";


Follow me on Twitter Reply With Quote




Last Updated on June 5, 2018


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts