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
Trying to understand strategy calculation logic
Collapse
X
-
Trying to understand strategy calculation logic
The strategy on the following T-bond futures chart has a tight profit goal=10 ticks and stop loss=10 ticks so that both goals are often hit on a day bar.
CalculateOnBarClose = true ... so apparently, because Ninja doesn't know whether the profit goal or stop loss was touched first, it conservatively assumes the stop is hit first. Just to be sure, IS THAT TRUE? ... If true, is there anyway to modify that logic?
Comment
-
Hello joemiller,
Thanks for your post.
When applying your strategy to a chart, historical trades are made on the bars and are performed as if CalculateOnBarClose is true, regardless of its setting in your strategy. This is because historical bars only consist of the Open, High, Low and Close values. So historically, outside of the 4 values, how the bar was built is unknown and the strategy will only execute once per bar.
In applying the strategy to historical bars, yes a conservative approach is built in where if the stoploss can be hit, it is hit. If the stop loss cannot be hit then the profit target will be hit in the example of small stop/profit and large bars.
If you want to test your strategy historically, with daily bars and small targets/stops you can use market replay where all of the ticks that make up each bar are available.
Alternatively, you can add a faster dataseries to your strategy, and not use the Set methods (setStopLoss or SetProfitTarget) but instead use ExitLongStopMarket() and ExitLongLimit() and applying them to the faster dataseries with the overload of the two methods, please see these references:
http://ninjatrader.com/support/helpG...itlongstop.htm
http://ninjatrader.com/support/helpG...gstoplimit.htmPaul H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Aviram Y, Today, 05:29 AM
|
0 responses
1 view
0 likes
|
Last Post
by Aviram Y
Today, 05:29 AM
|
||
Started by quantismo, 04-17-2024, 05:13 PM
|
3 responses
25 views
0 likes
|
Last Post Today, 05:23 AM | ||
Started by ScottWalsh, 04-16-2024, 04:29 PM
|
7 responses
34 views
0 likes
|
Last Post Today, 05:15 AM | ||
Started by cls71, Today, 04:45 AM
|
0 responses
6 views
0 likes
|
Last Post
by cls71
Today, 04:45 AM
|
||
Started by mjairg, 07-20-2023, 11:57 PM
|
3 responses
216 views
1 like
|
Last Post
by PaulMohn
Today, 04:22 AM
|
Comment