Thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to hold a position for half hour?
Collapse
X
-
Hi Jenny,
If you are working with the Condition Builder please review the information at the following link regarding time comparisons - http://www.ninjatrader-support.com/H...mparisons.html
If you are coding it in the NinjaScript Editor please see the following reference sample - http://www.ninjatrader-support.com/v...ead.php?t=3226
You can also work with the BarsSinceEntry() method to determine how many bars have elapsed.RayNinjaTrader Customer Service
-
MRO is very cool, but the first one works, the second one doesn't work.
LowBar1 =MRO(delegate {return (CrossBelow(SMA(5), SMA(10), 1));},1, 1440) return some number, but
HighBar1 =MRO(delegate {return (CrossBelow(SMA(5), SMA(10), 1));},2, 1440); return nothing, even not a "-1".
Would you please tell me why?
Thanks
Last edited by Jenny; 10-23-2007, 04:14 PM.
Comment
-
If you mean that it does not work in that it only returns a value of -1, then likely the condition is never met. You will likely spend some time debugging to understand what is happening.
If it does not work in terms of throwing exception (error message in the log tab of the Control Center window) then let me know.
Here is some information to help you debug. http://www.ninjatrader-support.com/v...ead.php?t=3418RayNinjaTrader Customer Service
Comment
-
I already use debug, it return nothing, even not "-1". If never met the condition, it should return "-1". And I can see the condition is met by the chart. Within 1440 bar, SMA(5) Cross over SMA(10) hundreds times! Do you think there is a bug some where?
Thanks
Comment
-
After some tests there is nothing wrong with the MRO. Please check out the reference sample I've attached. Try running it on your end. You should see two plots like how it looks in the attached image.
I suspect it to be a bug in your code somewhere since there seems to be no issue with this simple-as-possible indicator using MRO.
To install the reference sample please follow these steps:- Download the file contained in this thread to your PC desktop
- From the Control Center window, select the menu File > Utilities > Import NinjaScript
- Select the downloaded file
Josh P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
598 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
343 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
556 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
555 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment