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
Trying to Understand Order Handling Rules
Collapse
X
-
Hello Steve L,
Our development has let me know this is expected behavior and NinjaTrader 7 has the same behavior.
I've submitted this as a feature request 'orders placed at the same time using the same signal name should also follow the order handling rules' which is being tracked with ID# SFT-4115.
Please note it is up to the NinjaTrader Development to decide if or when any request will be implemented.
- Likes 1
-
Here's a full strategy example:
Code:// // Copyright (C) 2019, NinjaTrader LLC <www.ninjatrader.com>. // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release. // #region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.Indicators; using NinjaTrader.NinjaScript.DrawingTools; #endregion Using declarations //This namespace holds strategies in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Strategies.Barz.Sandbox { public class NTGeneralTestStrategy : Strategy { protected override void OnBarUpdate() { if (CurrentBar < BarsRequiredToTrade) { return; } if (Position.MarketPosition == MarketPosition.Flat && CurrentBar == 100) { EnterLongLimit(Close[0] * 0.8, "Entry1"); EnterLongStopMarket(Close[0] * 1.2, "Entry1"); } } protected override void OnStateChange() { if (State == State.SetDefaults) { Name = "NT General Test"; EntriesPerDirection = 10; } else if (State == State.Configure) { TraceOrders = true; } } } }
You can see that both orders have "Entry1" as their name and nothing is Ignored.
Leave a comment:
-
Thanks, Chelsea,
What I'm saying is the opposite: the orders have the same signal name and they do not conflict. Why not?
The rule says: "Methods that generate orders to enter a position will be ignored if: The entry signal name is not unique."
If you prefer, we can be more explicit:
Code:if (Position.MarketPosition == MarketPosition.Flat && CurrentBar == 100) { EnterLongLimit(Close[0] * 0.8, "MyEntry"); EnterLongStopMarket(Close[0] * 1.2, "MyEntry"); }
Code:Strategy 'Order Behavior (Managed)/171212758': Entered internal SubmitOrderManaged() method at 10/31/2018 4:00:00 PM... Strategy 'Order Behavior (Managed)/171212758': Entered internal SubmitOrderManaged() method at 10/31/2018 4:00:00 PM... Strategy 'Order Behavior (Managed)/171212758': Cancelled expired order... Strategy 'Order Behavior (Managed)/171212758': Cancelled expired order...
Last edited by Steve L; 06-11-2019, 04:14 PM.
Leave a comment:
-
Hello Steve L,
The signal name is the name of the order.
If you named one order "entry1" and another order "entry2", the order handling rules would not conflict for those orders.
Orders with unique signal names are independent.
Leave a comment:
-
Trying to Understand Order Handling Rules
I'm just trying to verify the order handling rules in the managed approach for myself so I know how everything works:
Here is the relevant section from the NT8 Help Guide:
The following rules are true per unique signal name:
Methods that generate orders to enter a position will be ignored if:- A position is open and an order submitted by a non market order exit method (ExitLongLimit() for example) is active and the order is used to open a position in the opposite direction
- A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction
- The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction
- The entry signal name is not unique
Specifically, in my tests, multiple entries with the same signal name are allowed when it sounds like they shouldn't be.
What is meant by the bolded item above, "The entry signal name is not unique."?
In the following I would have expected the 2nd order to be ignored because it has the same signal name, but both orders are accepted.
I assume I'm not interpreting the rules correctly and would appreciate any clarification.
Code:if (Position.MarketPosition == MarketPosition.Flat && CurrentBar == 100) { EnterLongLimit(Close[0] * 0.8); EnterLongStopMarket(Close[0] * 1.2); }
- EntriesPerDirection=10
- TraceOrders = true
Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by bortz, 11-06-2023, 08:04 AM
|
47 responses
1,607 views
0 likes
|
Last Post
by aligator
Today, 07:22 PM
|
||
Started by jaybedreamin, Today, 05:56 PM
|
0 responses
9 views
0 likes
|
Last Post
by jaybedreamin
Today, 05:56 PM
|
||
Started by DJ888, 04-16-2024, 06:09 PM
|
6 responses
19 views
0 likes
|
Last Post
by DJ888
Today, 05:12 PM
|
||
Started by Jon17, Today, 04:33 PM
|
0 responses
6 views
0 likes
|
Last Post
by Jon17
Today, 04:33 PM
|
||
Started by Javierw.ok, Today, 04:12 PM
|
0 responses
16 views
0 likes
|
Last Post
by Javierw.ok
Today, 04:12 PM
|
Leave a comment: