So in the below example, the DOW was at 28440 but that was a day ago. Today it is at 28582 (which does not meet my requirement for a trade).
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Strategy Waiting For Flat Position
Collapse
X
-
Strategy Waiting For Flat Position
I have a strategy that on occasion starts as "waiting for flat" status in orange (see pic below). The strategy accepts an "override" price argument that if is set will go place a trade if the market is within a couple points from the market price. From my testing it works fine as long as you pick an override price far away from where the market is/was at. I think the strategy is looking back and because the market price was recently my override price it assumes that the strategy is in a position when in fact I'm not.
So in the below example, the DOW was at 28440 but that was a day ago. Today it is at 28582 (which does not meet my requirement for a trade).
Tags: None
-
Hello bc24fl,
The wait until flat start behavior relies on how your strategy processes historical data. It sounds like you have added an input to help mitigate trading up to transitioning in realtime to avoid this, that is one possible way to get it to start immediately assuming it does not equate to having a position.
If the strategy in any situation equates to having a position in historical data you will see this happen.
You may be able to use a different start behavior if there is one that more closely matches your goals, you can read about each here: https://ninjatrader.com/support/help...hlightsub=sync
Another alternative is to not trade in historical if this is a realtime only strategy. You can just use if(State == State.Realtime) surrounding any order logic.
I look forward to being of further assistance.
-
I read that section of the help guide but not sure what option to select. If I select "Immediate Submit" it will place a trade even though currently the market price does not meet my criteria. I can try the (State == State.Realtime) but then I have to disable this option to test it in market replay.Originally posted by NinjaTrader_Jesse View PostHello bc24fl,
The wait until flat start behavior relies on how your strategy processes historical data. It sounds like you have added an input to help mitigate trading up to transitioning in realtime to avoid this, that is one possible way to get it to start immediately assuming it does not equate to having a position.
If the strategy in any situation equates to having a position in historical data you will see this happen.
You may be able to use a different start behavior if there is one that more closely matches your goals, you can read about each here: https://ninjatrader.com/support/help...hlightsub=sync
Another alternative is to not trade in historical if this is a realtime only strategy. You can just use if(State == State.Realtime) surrounding any order logic.
I look forward to being of further assistance.
Comment
-
Hello bc24fl,
If none of the start behaviors match the way you want to use the script you may need to look at using other means like logic. you could also use a user input to control allowing trading instead of using Realtime, that really depends on how you overall need to use the script. As a side note he Realtime condition would work in Playback but would not in historical modes like backtesting.
Please let me know if I may be of additional assistance.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
43 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
124 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
65 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment