NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 05-07-2008, 11:14 AM   #1
Burga1
Senior Member
 
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
Default String in incorrect format

Hi,

I'm getting an "Input string was not in a correct format" error for the following:


String textX = value2.ToString(); textX = textX.Substring(0); textX=textX.Insert(2, ".");
PREFIX = double.Parse(textX);


It is the last line causing the error (PREFIX = double.Parse(textX). The data for "value2" is simply price data in formats such as: 5408, 5397, 5400, 5398, 5402, etc...could the error be caused by trying to place the "." after "even" values such as the "5400"...since the trailing zeros will be dropped?
Burga1 is offline  
Reply With Quote
Old 05-07-2008, 11:28 AM   #2
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Please consult the standard MS docs on .NET coding issues.

Also:
- you might consider printing out textX to monitor the actual content.
- decimal sign might be dependent on actual country/language settings of your PC. Please consult the MS docs for e.g. numeric formatting issues related.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 05-07-2008, 12:04 PM   #3
Burga1
Senior Member
 
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you for the reply.
Burga1 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
Gui.Design.DisplayName string? NinjaCustomer Indicator Development 2 02-19-2008 10:46 PM
Wizard Problem with String Parameter zoltran General Programming 1 12-17-2007 07:23 AM
Formatting string number MAX General Programming 6 10-13-2007 11:20 AM
Function int NTFilled(string orderId) HelloHello Automated Trading 1 08-29-2007 02:40 AM
How to increment string? Richard Von Indicator Development 1 07-30-2007 07:16 AM


All times are GMT -6. The time now is 08:55 AM.