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 > General Programming

General Programming General NinjaScript programming questions.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 03-16-2011, 12:07 PM   #1
Zeos6
Senior Member
 
Join Date: Jan 2011
Posts: 294
Thanks: 9
Thanked 22 times in 19 posts
Default Strange Data Type Issue

Hi,

I was trying to perform an order of magnitude calculation when I ran into the following issue:

double rawPrice = (Open[0] + High[0] + Low[0] + Close[0]) * 0.25;
int magnitude = Math.Floor(Math.Log10(Math.Abs(rawPrice)));

This will not compile even though it should.

I had to do an explicit cast to get this to compile; i.e.

double rawPrice = (Open[0] + High[0] + Low[0] + Close[0]) * 0.25;
int magnitude = (int)Math.Floor(Math.Log10(Math.Abs(rawPrice)));

Am I missing something here? Please advise. Thank you very much.
Zeos6 is offline  
Reply With Quote
 

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
Data Series won't Display overnight data with 6 Range Type Trader108 Charting 11 02-17-2011 07:08 AM
Strategy - Strange result on SIM accout w/ live market data mjc4118 Version 7 Beta General Questions & Bug Reports 4 08-05-2010 11:09 AM
B14 - MBT data feed strange scenario. xTrader1 Version 7 Beta General Questions & Bug Reports 2 04-28-2010 12:05 PM
Strange issue with "Real time performance" screen Mike_D Automated Trading 1 01-21-2009 07:14 AM
very strange issue when I use the strategy wizard MoreYummy Automated Trading 4 08-05-2008 10:48 PM


All times are GMT -6. The time now is 09:00 PM.