When I load the chart, if I choose to load one day or I enter zero, it still loads the current day.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to Prevent Strategy From Starting Early?
Collapse
X
-
How to Prevent Strategy From Starting Early?
I open a day chart and begin my strategy. However, the chart loads the entire day and my strategy begins at the start of the day. This interferes with the real time function of the strategy. How can I have the strategy function only in real time?
When I load the chart, if I choose to load one day or I enter zero, it still loads the current day.Tags: None
-
Hello ronaldgreene828,
The most simple way is to add a condition to check the state. If you want to only work in realtime you can add the following condition in OnBarUpdate:
if(State != State.Realtime) return;
If you are using the builder you would need to add a condition into each set checking that the Misc -> CurrentState equals Misc -> State -> Realtime.
I look forward to being of further assistance.
-
Comment
-
Hello, this has worked well. At times I had to remove "State = State Realtime" from a set to prevent errors when running a strategy. Can you tell me where this line should not be included? Thanks
Comment
-
I found out that I wasn't using the right signal name in some of the exits. So I found the problem. Thanks
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
90 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
137 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
68 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
120 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
69 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment