NexusFi: Find Your Edge


Home Menu

 





Phase Calculation


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one eleven with 4 posts (1 thanks)
    2. looks_two Big Mike with 1 posts (0 thanks)
    3. looks_3 Zondor with 1 posts (2 thanks)
    4. looks_4 omaha786 with 1 posts (3 thanks)
    1. trending_up 2,901 views
    2. thumb_up 6 thanks given
    3. group 3 followers
    1. forum 7 posts
    2. attach_file 3 attachments




 
Search this Thread

Phase Calculation

  #1 (permalink)
 eleven 
California, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Kinetick
Trading: Currency Futures
Posts: 41 since Jul 2009
Thanks Given: 19
Thanks Received: 91

I have converted Ehlers Phase Calculation from EasyLanguage to Ninjatrader (C#). I also converted all the degrees to radians with is the .net default. However, the output is not what I expect. Would someone be as kind to review my code to see where I went wrong? I provided a link of the Phase Calculation EasyLanguage code.

Trader-Online.tk® - TradeStation™ Zone - Phase Calculation by John Ehlers

This indicator should oscillate between the range of 0 and 360 degree's.

Thanks.

Attached Files
Elite Membership required to download: Phase.cs
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
GFIs1 1 DAX trade per day journal
11 thanks
  #3 (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,440 since Jun 2009
Thanks Given: 33,212
Thanks Received: 101,599




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
  #4 (permalink)
 omaha786 
San Diego, California
 
Experience: Intermediate
Platform: Sierra Chart
Broker: IB, OEC, Optimus, DDT
Trading: ES, ZN
Posts: 221 since Jun 2010
Thanks Given: 512
Thanks Received: 158


eleven View Post
I have converted Ehlers Phase Calculation from EasyLanguage to Ninjatrader (C#). I also converted all the degrees to radians with is the .net default. However, the output is not what I expect. Would someone be as kind to review my code to see where I went wrong? I provided a link of the Phase Calculation EasyLanguage code.

Trader-Online.tk® - TradeStation™ Zone - Phase Calculation by John Ehlers

This indicator should oscillate between the range of 0 and 360 degree's.

Thanks.

I don't know both languages, so my comment is based on my previous programming experience in other languages.

Is CyclePeriod = DomCycle? If they have the same value, then there is a problem with the "for" loop:

for (int j = 0; j < CyclePeriod - 1; j++)

You may need to change it to:

for (int j = 0; j <= CyclePeriod - 1; j++)

or

for (int j = 0; j < CyclePeriod; j++)

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
 eleven 
California, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Kinetick
Trading: Currency Futures
Posts: 41 since Jul 2009
Thanks Given: 19
Thanks Received: 91

omaha,

It works! Thanks for taking a look at this. I will update the indy and post.

Mike,
Thanks for the bump.

eleven

Started this thread Reply With Quote
  #6 (permalink)
 eleven 
California, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Kinetick
Trading: Currency Futures
Posts: 41 since Jul 2009
Thanks Given: 19
Thanks Received: 91

I recently revisited this indicator and realized I didn't upload the final version. Here it is. I dusted this off and am looking at using it for an exit for a strategy I'm working on.

Attached Files
Elite Membership required to download: Phase.cs
Started this thread Reply With Quote
Thanked by:
  #7 (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

I wasn't pleased with the way this was coded. So I fixed it.

This version will probably run better on COBC false than the original did on COBC true.

It will accept inputs other than the Close (ie Median, Weighted, Typical, etc)

And I got rid of the annoying and dopey comments that the Ninjascript Indicator Wizard puts in. Really guys, you don't need that stuff. It's embarrassing.

See if you can figure out why I made these changes. The operations that I removed were totally unnecessary. And you don't need to calculate the value of 2*Pi over and over again on every bar, it will always be the same. How utterly ridiculous.

I tested it in Market Replay. It plots the same as the original.

I did this for the fun of it. Since I have an Intergalactic Media Empire, I don't need to worry about whether this indicator will actually make me any money.

Phase2.cs

"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.”
Prof. Albert Bartlett
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #8 (permalink)
 eleven 
California, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Kinetick
Trading: Currency Futures
Posts: 41 since Jul 2009
Thanks Given: 19
Thanks Received: 91

Right on. Thanks Zondor.

Started this thread Reply With Quote




Last Updated on December 29, 2012


© 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