Could this be accomplished by changing EntriesPerDirection dynamically? Or is there a better way?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
stop strategy from entering NEW positions after Stop hit
Collapse
X
-
stop strategy from entering NEW positions after Stop hit
If I hit a stop loss anytime during the day, I not only want to close the position but ALSO disable my strategy from entering any NEW positions. It still needs to manage the remaining open position(s) that weren't tied to the stop loss already hit.
Could this be accomplished by changing EntriesPerDirection dynamically? Or is there a better way?Tags: None
-
Hello YD777,
I have a few examples of a daily loss limit.
http://ninjatrader.com/support/forum...325#post490325
Instead of stopping new entries after the loss limit is hit, set a variable that is changed when a stop loss or exit order fills.Chelsea B.NinjaTrader Customer Service
-
Hello YD777,
Yes, this is possible by detecting the signal name of the order in OnExecution() or OnOrderUpdate().
Code:protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time) { if (execution.Order.Name == "Profit target") { // the profit target has had a fill or part fill } if (execution.Order.Name == "Stop loss") { // the stop loss has had a fill or part fill } if (execution.Order.Name == "Trail stop") { // the trailing stop loss has had a fill or part fill } } protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time, ErrorCode error, string comment) { // if the order is filled or part filled if (order.OrderState == OrderState.Filled || order.OrderState == OrderState.PartFilled) { if (order.Name == "Profit target") { // the profit target has had a fill or part fill } if (order.Name == "Stop loss") { // the stop loss has had a fill or part fill } if (order.Name == "Trail stop") { // the trailing stop loss has had a fill or part fill } } }
Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by UltraNIX, Today, 10:38 AM
|
0 responses
2 views
0 likes
|
Last Post
![]()
by UltraNIX
Today, 10:38 AM
|
||
Started by Photon66, Today, 09:49 AM
|
1 response
11 views
0 likes
|
Last Post
|
||
Started by jeff_dw, Today, 09:55 AM
|
1 response
5 views
0 likes
|
Last Post
|
||
Started by torch2k, Today, 10:17 AM
|
0 responses
5 views
0 likes
|
Last Post
![]()
by torch2k
Today, 10:17 AM
|
||
Started by successnow, Today, 09:42 AM
|
3 responses
18 views
0 likes
|
Last Post
|
Comment