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
How to setprofittarget based on candle open
Collapse
X
-
Hello Edress714,
Thanks for your post.
To clarify, are you using the Strategy Builder window or the NinjaScript Editor window to create your strategy?
When you mention "candle open vs entry price" are you trying to submit a profit target order to the current Open price when an entry order is filled?
Or, are you trying to set the profit target a set distance away from the Open price when the entry is filled?
We look forward to assisting further.Brandon H.NinjaTrader Customer Service
-
Hello Edress714,
Thanks for your notes.
You could call SetProfitTarget() in OnBarUpdate() in an unlocked script, set the CalculationMode property to CalculationMode.Price, and assign a price value of the Open[0] offset by a set number of ticks using TickSize.
For example, the code below would place the profit target 10 ticks above the current Open price.
Code:double ptPrice = Open[0] + 10 * TickSize; SetProfitTarget(CalculationMode.Price, ptPrice); EnterLong();
Here is a reference sample from the help guide demonstrating modifying the price of stop/target orders which you might also find helpful: https://ninjatrader.com/support/help...of_stop_lo.htmBrandon H.NinjaTrader Customer Service
Comment
-
Hello Edress714,
Thanks for your notes.
If you are running the strategy using Calculate.OnBarClose, this means the strategy will only process logic at the close of each bar. Meaning that Open[0] would refer to the Open price of the bar that just closed.
To have your strategy process logic intrabar, you would need to set the Calculate mode in your strategy to Calculate.OnPriceChange or Calculate.OnEachTick.
Calculate.OnPriceChange means OnBarUpdate() logic would process for each change in price. Calculate.OnEachTick means OnBarUpdate logic would process for each incoming tick.
When using Calculate.OnPriceChange() or Calculate.OnEachTick, Open[0] would refer to the Open price of the currently forming bar.
See this help guide page for more information about Calculate: https://ninjatrader.com/support/help.../calculate.htmBrandon H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by cutzpr, Today, 08:54 AM
|
0 responses
4 views
0 likes
|
Last Post
by cutzpr
Today, 08:54 AM
|
||
Started by benmarkal, Today, 08:44 AM
|
0 responses
5 views
0 likes
|
Last Post
by benmarkal
Today, 08:44 AM
|
||
Started by Tin34, Today, 03:30 AM
|
2 responses
26 views
0 likes
|
Last Post
by Tin34
Today, 04:11 AM
|
||
Started by sastrades, Yesterday, 09:59 AM
|
2 responses
38 views
0 likes
|
Last Post Today, 04:06 AM | ||
Started by ETFVoyageur, Today, 12:52 AM
|
1 response
21 views
0 likes
|
Last Post Today, 03:36 AM |
Comment