Buy at market opening 1st minute bar price +20 pts and simultaneously have a one cancels other order(OCO) to sell at 1st minute opening bar -20pts?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Condition builder help
Collapse
X
-
Condition builder help
I've managed this:
Set Variable0 to Open Price of Opening Time bar + Price 20
Set Enter Long with Stop/Limit when bar Close Price == Variable0
Set Variable1 to Open Price of Opening Time bar - Price 20
Set Enter Short with Stop/Limit when bar Close Price == Variable1
How do I get one trade to cancel the other when it triggers?
I'm looking at 'Order methods' in Help File.
-
Condition builder help
This might work I'm thinking(need to test):
When Variable0 matches price and Long position is triggered then set Variable1 to 0 so it can never match Price on future bars until it moves to next day and resets/initialises again at Opening Time.
Comment
-
Hello Shambo,
Welcome to our forums.
The main difficulty here is that you'll be running into NinjaTrader's internal order handling rules.
Methods that generate orders (excluding market orders) to enter a position will be ignored if:- A position is open and an order submitted by an 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
OCO functionality can be achieved by working with IOrder objects and checking order states.
Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by mattbsea, Today, 05:44 PM
|
0 responses
3 views
0 likes
|
Last Post
by mattbsea
Today, 05:44 PM
|
||
Started by RideMe, 04-07-2024, 04:54 PM
|
6 responses
31 views
0 likes
|
Last Post
by RideMe
Today, 05:31 PM
|
||
Started by tkaboris, Today, 05:13 PM
|
0 responses
2 views
0 likes
|
Last Post
by tkaboris
Today, 05:13 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
16 responses
3,282 views
0 likes
|
Last Post
by Leafcutter
Today, 04:14 PM
|
||
Started by WHICKED, Today, 12:45 PM
|
2 responses
20 views
0 likes
|
Last Post
by WHICKED
Today, 03:36 PM
|
Comment