Use of either == or >= results in error "Operator cannot be applied to operands of type"System.Date.Time" and "int"). Any ideas here? Regards to all
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
ToTime Error
Collapse
X
-
Hello elliot5,
Thank you for your post.
This error is stating that System.Date.Time cannot be compared to an int value. You would need to compare the Time series to a Time value. You could view the code that accomplishes this by setting up a time comparison in the Strategy Builder and selecting the 'View code' button.
Please see the help guide documentation below demonstrating how to make time comparisons.
Time Comparison - https://ninjatrader.com/support/help...imeComparisons
Let us know if we may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
-
Per the way the code is written, the error message is correct.Originally posted by elliot5 View Post&& ToTime(Time[0]) == 161200)
Use of either == or >= results in error "Operator cannot be applied to operands of type"System.Date.Time" and "int"). Any ideas here? Regards to all
The boolean '==' operator is being applied to "Time[0] == 161200", which is nonsensical.
The result of this '==' operation is then input to ToTime, which is also nonsensical.
But why that message?
Because the code has errors.
Because ToTime is missing its closing ')' parenthesis.Last edited by bltdavid; 05-19-2021, 02:22 PM.
- Likes 1
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
55 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
132 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
73 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
49 views
0 likes
|
Last Post
|

Comment