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
No announcement yet.
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
-
A cast will not fix the issue as you are essentially just changing the already erroneous value to a decimal type.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 SalmaTrader, 07-07-2026, 10:26 PM
|
0 responses
49 views
0 likes
|
Last Post
by SalmaTrader
07-07-2026, 10:26 PM
|
||
|
Started by CarlTrading, 07-05-2026, 01:16 PM
|
0 responses
22 views
0 likes
|
Last Post
by CarlTrading
07-05-2026, 01:16 PM
|
||
|
Started by CaptainJack, 06-17-2026, 10:32 AM
|
0 responses
15 views
0 likes
|
Last Post
by CaptainJack
06-17-2026, 10:32 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:15 AM
|
0 responses
21 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:15 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:06 AM
|
0 responses
23 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:06 AM
|

Comment