NexusFi: Find Your Edge


Home Menu

 





Translating EMA-values to ZN-values or visaversa


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one max-td with 8 posts (1 thanks)
    2. looks_two wh with 5 posts (0 thanks)
    3. looks_3 Big Mike with 3 posts (0 thanks)
    4. looks_4 Richard with 2 posts (1 thanks)
    1. trending_up 8,453 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 17 posts
    2. attach_file 3 attachments




 
Search this Thread

Translating EMA-values to ZN-values or visaversa

  #1 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

hi all,
ZN is seems to get trendy here in this area ;-)
but i realized that is has strange values and cant be used together with MAs in a strategy because of this. EMA values + ZN values are totaly different- ie. if you wanna code an ENTRY after the Bar closes Above / Below EMA 50 - thats not possible at the moment. i am looking looking for some ideas to manage this, maybe someone got a "translation-code" in his pocket yet ;-)
Thanks for infos
max-td

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
Exit Strategy
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Tao te Trade: way of the WLD
24 thanks
Just another trading journal: PA, Wyckoff & Trends
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #2 (permalink)
 
wh's Avatar
 wh 
Neubrandenburg, Germany
 
Experience: Advanced
Platform: R
Trading: Stocks
Posts: 538 since Jun 2009
Thanks Given: 298
Thanks Received: 512

hi max,

what are ZN-values. I do not know. but i think mike has same problem.

perhaps 123'234 anstead 123.57578 then i can give method ...

best regards

wh

Reply With Quote
  #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,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603


This code may be of use, it was provided by Roonius:

private string FormatZN(double price)
{
return String.Format("{0}'{1:000}", Math.Truncate(price), (price - Math.Truncate(price)) * 320);
}


The number "320" is the bond fraction or number of pips per point. ZN is 320.

Mike

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 
wh's Avatar
 wh 
Neubrandenburg, Germany
 
Experience: Advanced
Platform: R
Trading: Stocks
Posts: 538 since Jun 2009
Thanks Given: 298
Thanks Received: 512

private string whatisthat(double number)
{


//string s = "114.843750";

string s = Convert.ToString(number);
string[] numbers = s.split('.');

string zahler = "";
double dnenner = 0;

for(int i = 0; i < numbers.length; i++)
{
if(i == 0)
String zahler = numbers[i];

if(i == 1)
String tmp = numbers[i];

double dtmp = Double.Parse(tmp);
dnenner = dtmp/ 320;
}

string nenner = Convert.ToString(dnenner);

string val = zahler+"'"+nenner;

return val;
}

is not tested some bugs inside

Reply With Quote
  #5 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

hi - one more try - with your codeexamples i couldnt do anything - i am just a copy+paste coder.
But i know what i need
here is an example of my condition-idea - very simple stuff :

double ZNvalueclose = Close[0] ;
double ema33 = EMA (33) [0] ;

if ( ZNvalueclose < ema33 )

{ go short }

But now we konw the problem that ZN gives us (europeans espcialy ) some grazy numbers wich are not comparable with the EMA-values.

so i need a bit of math-magic to translate my ZNvalueclose into a normal valuedouble



double ZNvalueclose = Close[0] ;

double ZNvalueNORM = ZNvalueclose * magic-maths ;

double ema33 = EMA (33) [0] ;

if ( ZNvalueNORM < ema33 )

{ go short }

i always work with such doubles only - need no dataseries or other big things
please dont laugh - thats the way i code my things + it works + thats my goal

maybe someone got an idea

i saw this Math.Truncate-Method in mike psoting - but dont know what tish is / how to use it in my formular

max-td
Started this thread Reply With Quote
  #6 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

ok -another step DONE !

protected override void OnBarUpdate()
{

double EMAprice = EMA(30)[0];

string emaTOznvalue = String.Format("{0}'{1:000}", Math.Truncate(EMAprice), (EMAprice - Math.Truncate(EMAprice)) * 320);


emaTOznvalue now gives out the EMA in ZN-format
ie like : 114°025

next step is converting this string to a double to be able to use it for conditions in indicators or strategys in combination with PA (price-action)
stay tuned ...

max-td
Started this thread Reply With Quote
Thanked by:
  #7 (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,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603


max-td View Post
ok -another step DONE !

protected override void OnBarUpdate()
{

double EMAprice = EMA(30)[0];

string emaTOznvalue = String.Format("{0}'{1:000}", Math.Truncate(EMAprice), (EMAprice - Math.Truncate(EMAprice)) * 320);


emaTOznvalue now gives out the EMA in ZN-format
ie like : 114°025

next step is converting this string to a double to be able to use it for conditions in indicators or strategys in combination with PA (price-action)
stay tuned ...

Nice work max!

Mike

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #8 (permalink)
 
wh's Avatar
 wh 
Neubrandenburg, Germany
 
Experience: Advanced
Platform: R
Trading: Stocks
Posts: 538 since Jun 2009
Thanks Given: 298
Thanks Received: 512

you need a string format, that can you parse to a double.
or you use the replace function in c# and then do parsing ...

string s = "114°025";

string v = s.Replace("°", ".");

double z = Convert.ToDouble(v);

You need a dot that you get a good double value ...

Reply With Quote
  #9 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

Thats what i have - a propper sting with this ` - thing.
You see the output in the text-box.

max-td
Attached Thumbnails
Click image for larger version

Name:	ZN EMA.png
Views:	306
Size:	16.5 KB
ID:	204  
Attached Files
Elite Membership required to download: ZN_EMA_01.cs
Started this thread Reply With Quote
  #10 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927


oh - you think i have to replace that " ` " + make it a dot !?

max-td
Started this thread Reply With Quote




Last Updated on June 22, 2009


© 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