NexusFi: Find Your Edge


Home Menu

 





Looking for NT7 CCI Indicator based on EMA and not SMA


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Zondor with 9 posts (33 thanks)
    2. looks_two Silvester17 with 6 posts (17 thanks)
    3. looks_3 wldman with 5 posts (6 thanks)
    4. looks_4 Big Mike with 4 posts (2 thanks)
      Best Posters
    1. looks_one aligator with 4 thanks per post
    2. looks_two Zondor with 3.7 thanks per post
    3. looks_3 Silvester17 with 2.8 thanks per post
    4. looks_4 wldman with 1.2 thanks per post
    1. trending_up 12,121 views
    2. thumb_up 70 thanks given
    3. group 6 followers
    1. forum 29 posts
    2. attach_file 10 attachments




 
Search this Thread

Looking for NT7 CCI Indicator based on EMA and not SMA

  #1 (permalink)
 Nemesis 
Miami, Florida
 
Experience: Master
Platform: Ninja Trader 7
Broker: IQ Feed
Trading: Nasdaq Futures (NQ)
Posts: 7 since May 2010
Thanks Given: 0
Thanks Received: 2

The CCI Indicator on NT is SMA based, since I use EMA on my charts I would like to know if there is anyone out there that has coded one with EMA in mind and not SMA.

Thank you much for your time and help.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Futures True Range Report
The Elite Circle
Are there any eval firms that allow you to sink to your …
Traders Hideout
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
The Program
18 thanks
Battlestations: Show us your trading desks!
18 thanks
  #2 (permalink)
 
Silvester17's Avatar
 Silvester17 
Columbus, OH
Market Wizard
 
Experience: None
Platform: NT 8, TOS
Trading: ES
Posts: 3,603 since Aug 2009
Thanks Given: 5,139
Thanks Received: 11,527


Nemesis View Post
The CCI Indicator on NT is SMA based, since I use EMA on my charts I would like to know if there is anyone out there that has coded one with EMA in mind and not SMA.

Thank you much for your time and help.

@Nemesis,

this is the standard cci indicator from nt, but instead of sma with ema.


Reply With Quote
  #3 (permalink)
 
Zondor's Avatar
 Zondor 
Portland Oregon, United States
 
Experience: Beginner
Platform: Ninjatrader®
Broker: CQG, Kinetick
Trading: Gameplay Klownbine® Trading of Globex
Posts: 1,333 since Jul 2009
Thanks Given: 1,246
Thanks Received: 2,731


If the goal was to code an indicator that would waste as many CPU cycles as possible by calculating the same things over and over again, this was a brilliant success.

I will edit this post shortly to update a revised version.

OK, 20 minutes later, the wiseguy is back as promised, and here it is. It's obvious from the code that the loop that was previously executed on every tick is now executed only once per bar, and that the value of the EMA, previously calculated (period +1) times on every TICK, is now only calculated once per tick. (You can't rely on Ninjatrader's unreliable built in caching mechanism to ensure that these repetitive calculations do not happen.)

Of course, I also am using a predefined reusable instance of the EMA class to avoid having to create a new instance thereof on every bar, or to rely on the hope that Ninjatrader's creaky caching mechanism would render that expensive repetitive instantiation operation unnecessary.

However, benchmark testing is not included in my fee so the only thing to go on right now is the above analysis.

I also added multi colored plotting. To compensate for the reduced cpu load, I greatly lengthened the description of the indicator, written in classic Ninjatrader Gibberish style.

Default for COBC is now false. I am confident that performance will still be more than adequate.

I could also use the IDataseries trick to allow the calculation to be done with an MA selected from lots of different types of MA's in an Enum. Which other MA's would we like to see?

Saturday afternoon update. In the cold light of day I realized that I had over optimized. The expression within the loop depends on the current value of the EMA, which can change intrabar. Therefore the loop needs to run and the indicator needs to be updated not just OnFirstTickOfBar, but whenever the value of the EMA changes. But that is a lot less often than on every tick so there is still a huge reduction in CPU use compared to the original code. Code updated at 435PM PT October 20.

Attached Files
Elite Membership required to download: CCIema2.cs
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,396 since Jun 2009
Thanks Given: 33,172
Thanks Received: 101,537


Zondor View Post
If the goal was to code an indicator that would waste as many CPU cycles as possible by calculating the same things over and over again, this was a brilliant success.

I will edit this post shortly to update a revised version.

I'd also like to see benchmark results...



Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
 
Silvester17's Avatar
 Silvester17 
Columbus, OH
Market Wizard
 
Experience: None
Platform: NT 8, TOS
Trading: ES
Posts: 3,603 since Aug 2009
Thanks Given: 5,139
Thanks Received: 11,527


Zondor View Post
If the goal was to code an indicator that would waste as many CPU cycles as possible by calculating the same things over and over again, this was a brilliant success.

I will edit this post shortly to update a revised version.

OK, 20 minutes later, the wiseguy is back as promised, and here it is. It's obvious from the code that the loop that was previously executed on every tick is now executed only once per bar, and that the value of the EMA, previously calculated (period +1) times on every TICK, is now only calculated once per tick. (You can't rely on Ninjatrader's unreliable built in caching mechanism to ensure that these repetitive calculations do not happen.)

Of course, I also am using a predefined reusable instance of the EMA class to avoid having to create a new instance thereof on every bar, or to rely on the hope that Ninjatrader's creaky caching mechanism would render that expensive repetitive instantiation operation unnecessary.

However, benchmark testing is not included in my fee so the only thing to go on right now is the above analysis.

I also added multi colored plotting. To compensate for the reduced cpu load, I greatly lengthened the description of the indicator, written in classic Ninjatrader Gibberish style.

Default for COBC is now false. I am confident that performance will still be more than adequate.

I could also use the IDataseries trick to allow the calculation to be done with an MA selected from lots of different types of MA's in an Enum. Which other MA's would we like to see?

@Zondor,

thank you very much for your improved version.

and no, the goal was not to code an indicator that would waste as many CPU cycles as possible. that's exactly why I specifically wrote: this is the standard cci indicator from nt

Reply With Quote
Thanked by:
  #6 (permalink)
 
wldman's Avatar
 wldman 
Chicago Illinois USA
Legendary Market Wizard
 
Experience: Advanced
Broker: IB, ToS
Trading: /ES, US Equities/Options
Frequency: Several times daily
Duration: Hours
Posts: 3,507 since Aug 2011
Thanks Given: 2,046
Thanks Received: 9,491

@Zondor, would you consider taking a look at Winfrey's adaptive cci with the same critical eye. You are quite the wise guy...but I think I'm starting to understand your tone better.



I think that Mike's has a lot of code that I am not using. Just wonder if this version is a hog like you described or if cleaning out the unused code would make any difference.

Visit my NexusFi Trade Journal Reply With Quote
  #7 (permalink)
 
ThatManFromTexas's Avatar
 ThatManFromTexas 
Houston,Tx
 
Experience: Advanced
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: TF
Posts: 2,265 since Feb 2010
Thanks Given: 1,206
Thanks Received: 4,348


Silvester17 View Post
@Zondor,

thank you very much for your improved version.

and no, the goal was not to code an indicator that would waste as many CPU cycles as possible. that's exactly why I specifically wrote: this is the standard cci indicator from nt

@Silvester17

Congratulations ... you are now part of the elite group who have been Zondor'd ... that means you have unselfishly given of your time and written enough free indicators to catch the attention of he who stands watch over us mortal coders from on high ... and guides us down the path of the straight and narrow ...


Disclaimer: This post does not represent the view point of the owners, managers, or moderators of this web site and is not intended as a slam against any moderator, board member, any banned former members whose name we dare not say, any other living person, any recently living person or any person or persons whose status we are not sure of and especially not for any platform vendor with a questionable product and a pit bull lawyer. This post is meant purely for entertainment and should not be confused with a real thought.

I am not a programmer, coach, trainer or self appointed guru and do NOT hold myself up to be a good example for anything. I do not have a book, trading room or seminar. Even though I have an opinion on every subject under the sun, I do not give financial advice. Nor should I be held responsible for feeble attempts at humor at your expense. This post is meant purely for entertainment and should not be confused with a real thought.

I'm just a simple man trading a simple plan.

My daddy always said, "Every day above ground is a good day!"
Reply With Quote
  #8 (permalink)
 
Zondor's Avatar
 Zondor 
Portland Oregon, United States
 
Experience: Beginner
Platform: Ninjatrader®
Broker: CQG, Kinetick
Trading: Gameplay Klownbine® Trading of Globex
Posts: 1,333 since Jul 2009
Thanks Given: 1,246
Thanks Received: 2,731

If some of you guys would think about the changes I make and start using those techniques in your code, my sarcastic tone would miraculously change to one of sweetness. There is a thread regarding optimization of C# code that hasn't been very active lately, but I consider it to be very important. Unless you never use any indicators.

Where can I find the Winfrey Adaptive CCI?

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #9 (permalink)
 
casey44's Avatar
 casey44 
Louisville KY
 
Experience: Beginner
Platform: NT8
Trading: micros
Frequency: Daily
Duration: Minutes
Posts: 247 since Jan 2010
Thanks Given: 4,040
Thanks Received: 311


Zondor View Post
Where can I find the Winfrey Adaptive CCI?


@Zondor, best to hear from Wldman but think it's in this thread he initiated on the topic.


Mwinfrey, post 20: “The Adaptive_CCI and Alternate_Adaptive_CCI indicators are ones that a friend and I developed a very long time ago. I updated them a bit and got them running on NT7. Posted them at the link below. Let me know what you think about them.

Visit my NexusFi Trade Journal Reply With Quote
  #10 (permalink)
 
Zondor's Avatar
 Zondor 
Portland Oregon, United States
 
Experience: Beginner
Platform: Ninjatrader®
Broker: CQG, Kinetick
Trading: Gameplay Klownbine® Trading of Globex
Posts: 1,333 since Jul 2009
Thanks Given: 1,246
Thanks Received: 2,731


Thanks for link, Casey.

Anyone using my version of CCIema please see edit to above and update to latest cs file attached to that post.

The Adaptive CCI had a huge amount of arithmetic on every tick that only needs to be done once per bar. This is typical of the amateurish way that Ehlers indicators have been coded for Ninjatrader.

I really hit the jackpot by moving a switch in OnBarUpdate where it was running on every tick, to OnStartUp(), where it only runs ONCE. That's ONE TIME ONLY, not once per bar.

With the reduction of unnecessary arithmetic, this should run OK on the new default of COBC false. The number of executions of OnBarUpdate could be further reduced around 70% by not responding to redundant intrabar ticks. I will leave that to someone else to implement. It takes three lines of code.

I made some changes, but did not test it at all. At this point all I know is that it compiles. You guys are welcome to check it. Look for multiple /// marks where the changes were made.

Updated the file at 616PM PT. Added instantiation of the array of intrabar invariant Doubles to Initialize block. Updated display name for period of EMA used for slope calculation. Changed default plot colors.

Attached Files
Elite Membership required to download: Adaptive_CCI.cs
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on March 29, 2016


© 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