Does Strategy Analyzer have access to BarsArray[1].LastPrice
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
Strategy Analyzer Tick Data
Collapse
X
-
Hello dibDab,
Thanks for your post.
Please review the help guide document on the differences on real-time vs backtest (historical).
http://ninjatrader.com/support/helpG...ime_vs_bac.htm
When in historical data, only the Open, High, Low, and Close will be available and there will be no intra-bar data. This means actions cannot happen intra-bar, fills cannot happen intra-bar. All prices and actions come from and occur when the bar closes as this is all the information that is known.
Because of this, OnBarUpdate will only update 'On bar close' as it does not have the intra-bar information necessary for 'On price change' or 'On each tick' and the script will not have the intra-bar information to accurately fill an order at the exact price and time.
This could be possible by enabling Tick Replay when running backtests. Tick Replay would be used to have the logic process OnEachTick or OnPriceChange with historical data.
Note that this does not allow for intra-bar order fills. You would need to submit orders to that single-tick data series for a strategy that uses Tick Replay.
TickReplay — https://ninjatrader.com/support/help...ick_replay.htm
Developing for Tick Replay -
https://ninjatrader.com/support/helpGuides/nt8/developing_for__tick_replay.htm?zoom_highlightsub= developing+for+tick+replay
Additional information may be found in this NinjaTrader Forum post —
https://ninjatrader.com/support/foru...mance?t=102504
Let me know if I may assist further.Brandon H.NinjaTrader Customer Service
-
ok thanks but my strategy calculates on each tick and I use tick replay from the added tick series to submit orders, this works fine on a chart. just not on Strategy Analyzer.
Does Strategy Analyzer have access to BarsArray[1].LastPrice, when I do a Print in SA there is no value for BarsArray[1].LastPrice but there is in a chart.
Last edited by dibDab; 03-07-2023, 02:46 PM.
Comment
-
Hello dibDab,
Thanks for your note.
I have created a very simple strategy script that adds a 1-Tick series to the script and prints out BarsArray[1].LastPrice to the Output window.
When I run the script in the Strategy Analyzer with Tick Replay enabled, I do see the print appear in the Output window. See the attached screenshots.
That said, you could consider using the Playback connection to test your script instead of using the Strategy Analyzer.
Playback: https://ninjatrader.com/support/help...8/playback.htm
Please let me know if I may assist further.Brandon H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Option Whisperer, Today, 09:05 AM
|
0 responses
1 view
0 likes
|
Last Post Today, 09:05 AM | ||
Started by cre8able, Yesterday, 01:16 PM
|
3 responses
11 views
0 likes
|
Last Post
by cre8able
Today, 08:28 AM
|
||
Started by Harry, 05-02-2018, 01:54 PM
|
10 responses
3,203 views
0 likes
|
Last Post
by tharton3
Today, 08:52 AM
|
||
Started by ChartTourist, Today, 08:22 AM
|
0 responses
6 views
0 likes
|
Last Post
by ChartTourist
Today, 08:22 AM
|
||
Started by LiamTwine, Today, 08:10 AM
|
0 responses
2 views
0 likes
|
Last Post
by LiamTwine
Today, 08:10 AM
|
Comment