Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Chase If Touched in a strategy script?
Collapse
X
-
Chase If Touched in a strategy script?
Can I access Chase If Touched programmatically to use in a strategy I'm coding?Tags: None
-
Hello Lance El Camino,
Thank you for your post.
What exact behavior are you looking for with Chase If Touched in a strategy? For example, do you want this to be tied to an entry order or a stop/target order? Are you building it in the Strategy Builder or working with an unlocked script in the NinjaScript Editor? Please provide an example of what you are hoping to achieve so I may better understand and assist you.
I look forward to your reply.
-
I need Chase If Touched for Stop limit entry orders that don't get filled. I'm using an unlocked script in the editor. When conditions are met OnBarClose, a stop limit order is placed and usually gets filled but at times it doesn't and then cancels unfilled at bar close. So in the case of a Long Stop Limit, if price moves above the order and it doesn't fill, how can I chase price without using a market order?
Comment
-
Hello Lance El Camino,
Thank you for your reply.
We have some ProfitChaseStopTrail examples at the following link:
These examples show how to trigger a profit target that triggers a chase once a certain amount is hit as well as how to set a stop loss to trail; these same ideas for modifying an order and its price can still be used to modify your Stop Limit entry orders.
"When conditions are met OnBarClose, a stop limit order is placed and usually gets filled but at times it doesn't and then cancels unfilled at bar close." This sounds like you are describing the default behavior of an order that will cancel on the close of the bar if the condition for entry is no longer met and the order did not get filled. If you would like to keep an order "alive" even if it has not been filled by the end of the bar it was entered on, you could consider using IsLIveUntilCanceled orders. More information and examples of keeping orders alive, as well as how to cancel orders explicitly with CancelOrder() (since they won't be auto-canceled at the end of the bar) may be found at the following links:Please let us know if we may be of further assistance.
Comment
-
Thanks. So I'm describing times when price blows past the stop limit order in the same bar, not when it cancels due to being untouched at bar close: "So in the case of a Long Stop Limit, if price moves above the order and it doesn't fill, how can I chase price without using a market order?" I realize that if I added conditions to chase price if the order doesn't fill then it won't do anything until that bar closes which is not favorable. I don't want to keep an order alive if unfilled at the close of the bar if price never reached it. I'm wondering if in the rare occasion that price doesn't fill the stop limit order due to it moving rapidly, is there a way to chase via limit order intrabar in the OnBarClose calculation?
Comment
-
Hello Lance El Camino,
Thank you for your reply.
If you initially submit a Stop Limit order and want to detect when the price moves to the other side of the order without it filling, you could make a comparison considering the order state and if the Close[0] price is on the other side of the order. If so, you could then cancel that order with CancelOrder() and submit a Limit order that chases the price using similar chase logic to modify the order prices as demonstrated in the previously mentioned samples.
To have intrabar actions, the strategy will need to calculate either OnPriceChange or OnEachTick. You may still have logic that is only evaluated OnBarClose by checking if IsFirstTickOfBar is true. The following sample demonstrates how to separate logic to calculate once per bar or on every tick:
Feel free to reach out with any additional questions or concerns.
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
44 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