Is there an easy way to determine this within OnBarUpdate (i.e., without having to get into OnOrderUpdate)?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Identifying entry signal of current position
Collapse
X
-
Identifying entry signal of current position
My strategy uses multiple entry signals (e.g., Signal1, Signal2, etc.). I'd like to have different stoploss modifications for these entries (e.g., Signal1 stoploss modification, etc.), so when I have an existing position, I need to be able to determine which entry signal generated that position in order to apply the correct stoploss adjustment.
Is there an easy way to determine this within OnBarUpdate (i.e., without having to get into OnOrderUpdate)?Tags: None
-
Hello dolomite,
Thank you for your post.
You would likely want to associate the Position.AvgPrice with the order that you submitted, that is if the two entries used different price levels. However, this is not exact - what if both orders fill at the same price? Plus if both orders fill and not at the same price level we would pull the average price of the two fills.
What are you trying to adjust? A SetStopLoss() or an Exit method?
-
SetStopLossOriginally posted by NinjaTrader_PatrickH View PostWhat are you trying to adjust? A SetStopLoss() or an Exit method?
So I'm something like . .
If [have an existing position from Signal1]
SetStopLoss("Signal1", CalculationMode.Price, some calculated price, false)
If [have an existing position from Signal2]
SetStopLoss("Signal2", CalculationMode.Price, some other calculated price, false)Last edited by dolomite; 02-19-2015, 12:59 PM.
Comment
-
Hello dolomite,
Thank you for your response.
Track the execution of the entry in OnExecution(), store the values of the fill price and/or track that a position is opened by a signalName. Then check these value sin OnBarUpdate().
For information on OnExecution() please visit the following link: http://www.ninjatrader.com/support/h...nexecution.htm
Comment
-
I was hoping to keep this simple and stay in OnBarUpdate, but if I must mess around with OnExecution, I guess I will.Originally posted by NinjaTrader_PatrickH View PostHello dolomite,
Thank you for your response.
Track the execution of the entry in OnExecution(), store the values of the fill price and/or track that a position is opened by a signalName. Then check these value sin OnBarUpdate().
For information on OnExecution() please visit the following link: http://www.ninjatrader.com/support/h...nexecution.htm
What happens if I don't check to see which signal a position was created from, and simply execute the following:
SetStopLoss("Signal1", CalculationMode.Price, some calculated price, false)
SetStopLoss("Signal2", CalculationMode.Price, some other calculated price, false)
If there is no position created by Signal1 entry, will this throw an error?
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
590 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
342 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
555 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment