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
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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.
JesseNinjaTrader Customer Service
-
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.JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by patrickmlee007, Today, 09:33 AM
|
1 response
6 views
0 likes
|
Last Post Today, 02:48 PM | ||
Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
|
53 responses
5,305 views
0 likes
|
Last Post
by BartMan
Today, 02:46 PM
|
||
Started by Richozzy38, Today, 01:06 PM
|
2 responses
12 views
0 likes
|
Last Post
by Richozzy38
Today, 02:39 PM
|
||
Started by Lele2k24, Today, 01:32 PM
|
4 responses
10 views
0 likes
|
Last Post
by Lele2k24
Today, 02:23 PM
|
||
Started by Sebastian - TwinPeaks, Today, 01:31 PM
|
1 response
7 views
0 likes
|
Last Post Today, 02:01 PM |
Comment