Is there an easy way to determine this within OnBarUpdate (i.e., without having to get into OnOrderUpdate)?
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
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?
-
Originally 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
-
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 yertle, Today, 08:38 AM
|
6 responses
25 views
0 likes
|
Last Post
by ryjoga
Today, 09:17 PM
|
||
Started by algospoke, Yesterday, 06:40 PM
|
2 responses
24 views
0 likes
|
Last Post
by algospoke
Today, 07:04 PM
|
||
Started by ghoul, Today, 06:02 PM
|
3 responses
16 views
0 likes
|
Last Post Today, 06:43 PM | ||
Started by jeronymite, 04-12-2024, 04:26 PM
|
3 responses
46 views
0 likes
|
Last Post
by jeronymite
Yesterday, 10:10 PM
|
||
Started by Barry Milan, Yesterday, 10:35 PM
|
7 responses
23 views
0 likes
|
Last Post Today, 06:16 PM |
Comment