NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 03-03-2012, 12:52 PM   #1
stocktraderbmp
Senior Member
 
Join Date: Jun 2011
Location: Ireland
Posts: 184
Thanks: 32
Thanked 20 times in 19 posts
Default formula conversion

Hi;

Can anybody help please,

I am, unfortunately, having to trade with the T4 platform for the next 2 weeks and am trying to write a code in xml.

I have the bulk of it but I am trying to convert the VMA indicator and dont understand the code text for the smoothing constant:

double sc = 2.0 / (double)(period + 1);

in xml I have got sc = 2.0/ ?what?(period + 1);

obviously I dont know what the ?what? should be.

Can anybody help please to explain what the 'double' is. I have looked it up in the C# ref guide on line but still don't understand - something to do with converting it to 1 decimal place or something I think.
Any help gratefully appreciated.

Ben
stocktraderbmp is offline  
Reply With Quote
Old 03-03-2012, 02:59 PM   #2
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

stocktraderbmp,

(double) is attempting to cast the equation (period+1) as a double, so that it can be used in calculations with other double, in this case 2.0 . You can think of it as converting one data type to another.

http://msdn.microsoft.com/en-us/libr...(v=vs.71).aspx

Hopefully someone can help you with the XML portion, as this is unsupported by NT support.

Please let me know if I may be of further assistance.
NinjaTrader_AdamP is offline  
Reply With Quote
The following user says thank you to NinjaTrader_AdamP for this post:
Old 03-03-2012, 03:05 PM   #3
stocktraderbmp
Senior Member
 
Join Date: Jun 2011
Location: Ireland
Posts: 184
Thanks: 32
Thanked 20 times in 19 posts
Default

Thanks Adam that answers the question the XML bit I can work out from that thanks again
stocktraderbmp is offline  
Reply With Quote
The following user says thank you to stocktraderbmp for this post:
Old 03-03-2012, 03:14 PM   #4
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

stocktrader,

We are always happy to assist. Have a nice weekend!
NinjaTrader_AdamP is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using StdDev in a formula stocktraderbmp Indicator Development 16 01-11-2012 03:22 AM
Formula of Slope msamadov General Programming 2 11-11-2011 05:34 AM
TSV: Time segmented volume formula conversion skynetman Indicator Development 11 04-28-2011 04:27 AM
Can I get the Formula? un$ane Strategy Development 1 06-26-2009 05:16 AM
CCI formula pipsheker General Programming 2 05-17-2008 06:57 AM


All times are GMT -6. The time now is 11:53 AM.