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 > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 07-08-2008, 07:04 PM   #1
Ninja B
Member
 
Join Date: Apr 2008
Posts: 99
Thanks: 0
Thanked 0 times in 0 posts
Question Use the rounded value instead of the exact value with decimals?

I want the strategy to use indicator's rounded value that is displayed in the price marker on the chart. When the moving averages are displayed in Panel 2 and I can see the extra decimal points. I don't want to use those exact values/calculations just the rounded ones.
Ninja B is offline  
Reply With Quote
Old 07-08-2008, 08:31 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Are you using the wizard or programming directly?
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-08-2008, 08:56 PM   #3
Ninja B
Member
 
Join Date: Apr 2008
Posts: 99
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
Are you using the wizard or programming directly?
The Wizard.
Ninja B is offline  
Reply With Quote
Old 07-08-2008, 09:04 PM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Thanks for the clarification. Unfortunately this is not possible to do in the wizard. By directly programming it is using the Instrument.Round2TickSize() method.

More information on this here - http://www.ninjatrader-support.com/H...2TickSize.html
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-08-2008, 09:12 PM   #5
Ninja B
Member
 
Join Date: Apr 2008
Posts: 99
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks for the help.
Ninja B is offline  
Reply With Quote
Old 07-09-2008, 08:34 AM   #6
Ninja B
Member
 
Join Date: Apr 2008
Posts: 99
Thanks: 0
Thanked 0 times in 0 posts
Default

I'm having trouble doing this. Is the Round2Tick Method the only way?
Ninja B is offline  
Reply With Quote
Old 07-09-2008, 08:35 AM   #7
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

You could code yourself what we have wrapped in the Round2TickSize method but this wil be a lot harder than just using the method already provided.
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-09-2008, 08:45 AM   #8
Ninja B
Member
 
Join Date: Apr 2008
Posts: 99
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
You could code yourself what we have wrapped in the Round2TickSize method but this wil be a lot harder than just using the method already provided.
{
double price; Instrument.MasterInstrument.Round2TickSize();
}

Is this the correct way? I put this ^^^under


protected override void OnBarUpdate()
{
Ninja B is offline  
Reply With Quote
Old 07-09-2008, 08:52 AM   #9
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

No, something like:

double myDouble = Instrument.MasterInstrument.Round2TickSize(yourInd icatorValue);
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-09-2008, 09:45 AM   #10
RJay
Senior Member
 
Join Date: May 2008
Location: Hartford, CT. USA
Posts: 618
Thanks: 12
Thanked 24 times in 18 posts
Default

More info here...


http://msdn.microsoft.com/en-us/libr...nd(VS.71).aspx

This example of the decimal.Round( decimal, Integer )
method generates the following output.

Argument``` Digits ```Result
-------- ```------ ```------
1.45 ````````1``````` 1.4
1.55 ````````1 ```````1.6
123.456789 ``4 `````123.4568
123.456789 ``6 `````123.456789
123.456789 ``8 `````123.456789
-123.456 ````0 `````-123
-123.0000000 3 `````-123.000


decimal == Argument
Integer == Digits
Result == the final output.



I also used this to convert a dataseries double value to an integer...

period = (int) Math.Round(Value5[0]);

Good Luck,

RJay
Last edited by RJay; 07-09-2008 at 10:25 AM.
RJay is offline  
Reply With Quote
Old 07-09-2008, 10:03 AM   #11
Ninja B
Member
 
Join Date: Apr 2008
Posts: 99
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by rt6176 View Post
More info here...


http://msdn.microsoft.com/en-us/library/system.decimal.round(VS.71).aspx

This example of the decimal.Round( decimal, Integer )
method generates the following output.

Argument``` Digits ```Result
-------- ```------ ```------
1.45 ````````1``````` 1.4
1.55 ````````1 ```````1.6
123.456789 ``4 `````123.4568
123.456789 ``6 `````123.456789
123.456789 ``8 `````123.456789
-123.456 ````0 `````-123
-123.0000000 3 `````-123.000


decimal == Argument
Integer == Digits
Result == the final output.



I also used this to convert a dataseries double value to an interger...

period = (int) Math.Round(Value5[0]);

Good Luck,

RJay
Thanks for the help. I really appreciate. Still trying to get it working.
Ninja B is offline  
Reply With Quote
Old 07-10-2008, 01:57 PM   #12
Ninja B
Member
 
Join Date: Apr 2008
Posts: 99
Thanks: 0
Thanked 0 times in 0 posts
Default

I've given up on doing this myself but I'm trying to get in contact with NinjaScript consultants to have this done instead. 2 of them haven't replied to emails, one of them being Ben from AffordableIndicators. The other one Kama has no links to get in contact which is weird. The one who actually replied is too expensive. Are there any other consultants that help with this or another way to get in contact with Ben from AffordableIndicators?

Please help

Ninja B is offline  
Reply With Quote
Old 07-10-2008, 02:06 PM   #13
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

On KamaCoder there is a "Contact Us" menu - http://www.kamacoder.com/ContactUs.aspx

I will send a note to Ben.
NinjaTrader_Ray 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
How to not display decimals LG General Programming 4 04-18-2008 02:04 PM
FX Entry Decimals trader2be Connecting 2 12-13-2007 09:24 PM
Variable rounded Richard Von Indicator Development 3 08-03-2007 06:55 AM
fractions/decimals Gar Miscellaneous Support 3 05-24-2005 03:07 AM


All times are GMT -6. The time now is 02:56 PM.