FGBL has tick of 0.01. Now, when I backtested a strategy, High[0] - Low[0] equals to 0.06000000000023. How is this even possible?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Strange values
Collapse
X
-
Strange values
Hi,
FGBL has tick of 0.01. Now, when I backtested a strategy, High[0] - Low[0] equals to 0.06000000000023. How is this even possible? -
Hello TJohn,
Thank you for your inquiry.
The reason why this is occurring is because you are subtracting two doubles. Doubles are a floating binary point datatype.
I suggest reading this particular question on Stack Overflow that goes in-depth with this: http://stackoverflow.com/questions/9...45000000000001
Please, let us know if we may be of further assistance.Zachary G.NinjaTrader Customer Service
Comment
-
Originally posted by TJohn View PostSo a cast like this should solve the problem?
(decimal)(High[0] - Low[0])
eDanny has provided an excellent solution that will solve the problem for you:
Originally posted by eDanny View PostInstrument.MasterInstrument.Round2TickSize(High[0] - Low[0]);Zachary G.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Jonker, Today, 01:19 PM
|
0 responses
1 view
0 likes
|
Last Post
by Jonker
Today, 01:19 PM
|
||
Started by futtrader, Today, 01:16 PM
|
0 responses
5 views
0 likes
|
Last Post
by futtrader
Today, 01:16 PM
|
||
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
14 responses
1,791 views
0 likes
|
Last Post
by aligator
Today, 11:47 AM
|
||
Started by Jimmyk, 01-26-2018, 05:19 AM
|
6 responses
844 views
0 likes
|
Last Post
by emuns
Today, 11:27 AM
|
||
Started by jxs_xrj, 01-12-2020, 09:49 AM
|
6 responses
3,296 views
1 like
|
Last Post
by jgualdronc
Today, 10:56 AM
|
Comment