Are there some functions/tricks that I should be aware of for this?
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
Is it possible to see a bar before its fully closed in a backtest?
Collapse
X
-
Is it possible to see a bar before its fully closed in a backtest?
If I have a strategy that depends on weekly bars, but I want to know what a bar looks like before it closes, what is the best way to do so? The reason for this is because when I'm running my strategy in real-time, Close[0] references the current, unfinished weekly bar (for example if today is Wednesday, it would show Close[0] as the Close of Wednesday). However, when I run this code in a backtest, Close[0] returns the Close from 5 days ago (last Friday). This is a bit annoying to have to use Close[1] in Real-time in order to get the same results as my backtest's Close[0]. In addition, if my strategy does require knowledge of unfinished candles, it seems like that is not possible in backtests unless I manually aggregate the 1-minute chart, for example, into a pseudo-weekly bar for Sunday-Wednesday.
Are there some functions/tricks that I should be aware of for this?Tags: None
-
Use the replay function. It will replay the period tick by tick. You can jump also, if you wish, to certain moments to speed up things a bit.
To use the replay function you should download that data day by day. To do that, click:
Control center
File
Utilities
Download replay data
or change the settings. To do that, click:
Control center
Tools
Options
Data
Select "Record for marketplay".
If the settings are changed NT will save all the detailed data from that moment on. So for past data you should download it.
Don't forget to put for the indicator "Calculate on the bar close" to false, or you will not see the indicator change permanently.Last edited by marcus2300; 11-24-2018, 06:15 PM.
-
Hi marcus. I'm still having issues in backtests. https://ninjatrader.com/support/help...a_strategy.htm says that backtests can only be run on the CLOSE of candles. However, if I have 5 minute data and Tick data as my two data series for my backtest, is there a way to calculate the current 5 minute bar from the tick data? This would help me mimic real-time market dynamics for backtests.
Comment
-
I backtest manually. A good backtest would test at least every 1 minute, not just the close of the bar. That can make a huge difference in performance.Last edited by marcus2300; 11-25-2018, 03:39 AM.
Comment
-
Hello stokhastic,
Thank you for writing in.
Backtests are based off historical performance and historical bars, there would be no supported method for testing the performance including the current bar while testing with the strategy analyzer.
You could use Market Playback to test how a strategy has preformed up to the current moment.
Please let us know if you need further assistance.
Alan P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by johnMoss, 03-04-2024, 01:53 PM
|
3 responses
40 views
0 likes
|
Last Post
by AndyM
Today, 06:13 PM
|
||
Started by algospoke, Today, 06:01 PM
|
0 responses
2 views
0 likes
|
Last Post
by algospoke
Today, 06:01 PM
|
||
Started by cre8able, Today, 05:53 PM
|
0 responses
3 views
0 likes
|
Last Post
by cre8able
Today, 05:53 PM
|
||
Started by Wessel, 03-23-2024, 02:37 PM
|
3 responses
23 views
0 likes
|
Last Post Today, 04:58 PM | ||
Started by martini, Yesterday, 04:45 PM
|
4 responses
32 views
0 likes
|
Last Post
by martini
Today, 04:48 PM
|
Comment