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 AaronKoRn, Today, 09:49 PM
|
0 responses
5 views
0 likes
|
Last Post
by AaronKoRn
Today, 09:49 PM
|
||
Started by carnitron, Today, 08:42 PM
|
0 responses
8 views
0 likes
|
Last Post
by carnitron
Today, 08:42 PM
|
||
Started by strategist007, Today, 07:51 PM
|
0 responses
9 views
0 likes
|
Last Post Today, 07:51 PM | ||
Started by StockTrader88, 03-06-2021, 08:58 AM
|
44 responses
3,975 views
3 likes
|
Last Post
by jhudas88
Today, 06:59 PM
|
||
Started by rbeckmann05, Today, 06:48 PM
|
0 responses
9 views
0 likes
|
Last Post
by rbeckmann05
Today, 06:48 PM
|
Comment