For some reason the "End on Session Close" option does not work on Daily charts. Is there another option specifically for Daily Charts to end a strategy and the close of the trading day?
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
End on Session close on Daily charts?
Collapse
X
-
Hello omermirza,
Thanks for your post.
Exit On Session Close is derived from the Trading Hours template and these are not applied to daily bars, which are provided as is from the data provider.
You could consider building a 1440 minute chart with a Trading Hours template you like and you will have a daily bar that follows those hours, and ExitOnSessionClose would be used. However, if the strategy is backtesting or is otherwise processing OnBarClose, order submissions that are triggered on bar closes would be cancelled. This may not be a viable solution for your needs.
My suggestion to move forward would be to create a Multi Time Frame strategy and use a time check in the smaller timeframe to call ExitLong/ExitShort to close the position.
Multi time Frame and Instruments - https://ninjatrader.com/support/help...nstruments.htm
ToTime can be used to convert bar timestamps (Time[0]) to an integer format that is easy to create time filters/time checks.
ToTime - https://ninjatrader.com/support/help...t8/?totime.htm
We look forward to assisting.JimNinjaTrader Customer Service
-
Hello Omer,
Trading Hours templates are applied to a Data Series. This can be set in the Data Series window of a chart or in the Data Series parameters section of the property grid when adding the strategy to the Control Center or backtesting in the Strategy Analyzer.
Please note that bar closures are signaled on the first tick of a bar, so if you wait on bar since the entry was executed to close the position, and the entry was made mid bar, you would be waiting for another bar to close which may be longer than your want.
Try having a look at the SampleIntrabarBacktest example which submits orders to a single tick data series. This can be applied against a daily data series and you can see ExitOnSessionClose happening when we backtest and test in realtime. I would suggest this as a first step, and if you need intrabar Calculate.OnPriceChange or Calculate.OnEachTick when backtesting, you can enable Tick Replay.
SampleIntrabarBacktest - https://ninjatrader.com/support/help...ipt_strate.htm
Note that Tick Replay allows intrabar logic to be processed, but orders will still be filled by the data series we submit the order to. To achieve intrabar OnEachTick/OnPriceChange AND have orders filled intrabar, Tick Replay must be used AND orders must be submitted to a single tick data series.
Please let us know if you have any additional questions.JimNinjaTrader Customer Service
Comment
-
Thanks alot - I think I've got it now. So basically I need to:- Set up a 1440 min chart with the proper Trading Hours Template
- Ensure TIck Replay is enabled
- Add a secondary Data Series - 1 tick
- Ensure that the order are passed to the 1 tick Data Series
I can then use "End on Session Close" and this will also be accurately backtestable ?
Comment
-
Hello Omer,
Thanks for your reply.
I would suggest using a 1440minute bar instead of a daily bar when you want to use a specific Trading Hours template since the Trading Hours templates would not filter the data in a daily bar, which is provided from the data provider as-is.
You could still use a daily bar with ExitOnSessionClose and have orders submitted to a single tick data series, but if your strategy is calculating OnEachTick or OnPriceChange and Tick Replay is not used, you will see cases where positions get opened on the next bar and closed on the same bar. You can test our SampleIntrabarBacktest strategy to observe (screenshot attached.)
We look forward to assisting.JimNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by johntraderuser2, Today, 02:34 AM
|
0 responses
6 views
0 likes
|
Last Post Today, 02:34 AM | ||
Started by IanS00, 03-27-2024, 11:24 AM
|
2 responses
12 views
0 likes
|
Last Post Today, 02:00 AM | ||
Started by Mariawilcoxi, Today, 01:32 AM
|
0 responses
5 views
0 likes
|
Last Post
by Mariawilcoxi
Today, 01:32 AM
|
||
Started by gleichnerany, Today, 01:17 AM
|
0 responses
5 views
0 likes
|
Last Post
by gleichnerany
Today, 01:17 AM
|
||
Started by WHICKED, 03-27-2024, 12:33 PM
|
4 responses
47 views
0 likes
|
Last Post Today, 12:28 AM |
Comment