Announcement
Collapse
No announcement yet.
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.htm
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
566 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
330 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
547 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
548 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment