Shouldnt it only allow strategies with On Bar close? thanks
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
analyzer restrictions
Collapse
X
-
Strategy Analyzer already does that -- it always ignores your
Calculate setting and always uses OnBarClose internally.
Because of the limitations of historical data, the Strategy Analyzer
can only call your OnBarUpdate at the close of each bar, thus
OnEachTick and OnPriceChange are ignored by the Strategy
Analyzer.
In contrast, when your strategy is running with a real-time data
feed, oh Lord yes, the Calculate setting there is very important.
Strategy Analyzer testing != Real-time executionLast edited by bltdavid; 12-07-2021, 12:13 AM.
-
-
Hello ezrollin and JennyMalin,
Thank you for your posts.
bltdavid is correct here.
You should expect that a strategy running real-time (live brokerage account, live market simulation, Market Replay etc...) will produce different results than the performance results generated during a backtest over historical data on a chart or in the Strategy Analyzer. This difference may be more easily seen on certain Bars types (e.g. Point and Figure, renko) than others due to their inherent nature in bar formation.
During a backtest you can select conservative or liberal fill algorithms which will produce different results. Fills are determined based on 4 data points, the OHLC of a bar, since that is the only information that is known during a backtest 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'.
Also, here is a link to the differences on real-time vs backtest (historical).
http://ninjatrader.com/support/helpG...ime_vs_bac.htm
Adding intra-bar granularity can help with this if your strategy normally runs OnEachTick or OnPriceChange in real time.
Intra-bar granularity adds a second data series such as a 1 tick series so that the strategy has finer granularity in the historical data in between the OHLC of the primary series. This allows for more accurate trades by supplying the correct price at the correct time for the order to fill with.
In NinjaTrader 8, there have been two new enhancements so that programmers do not have to manually add this secondary series and code the script to for high accuracy fills (Order Fill Resolution) and for intra-bar actions (TickReplay).
Here is a link to our forums that goes into depth on using Order Fill Resolution and Tick Replay to ensure your backtests are as close to real time results as possible:
https://ninjatrader.com/support/foru...mance?t=102504
High Fill Order Resolution and TickReplay cannot be used together. If it is necessary to have both, it is still possible to add intra-bar granularity to a script in the code itself for order fill accuracy and use TickReplay to update indicators with Calculate set to OnPriceChange or OnEachTick historically.
Further information regarding the Strategy Analyzer may be found in our help guide here:
Please let us know if we may be of further assistance to you.Kate W.NinjaTrader Customer Service
Comment
-
Hmm, still awfully vague there .. for ex, what is the 'wrong way'?
Seriously, what do you mean by 'wrong way' -- SA only works one way.
What is Strategy Analyzer supposed to protect the rookie from doing?
Are we still talking about the Calculate setting?
Anyways, since you asked, here's my subjective take on an answer.
Simply put: No.
The Strategy Analyzer is already doing the default thing, which is OnBarClose.
The fact that you can't change that is a matter of learning and understanding
the product.
What I mean is, you'll note that the Strategy Analyzer does not have a property
setting for 'Calculate' in its property grid, so right there, score 1 for protecting
the rookie.
You'll also note that Strategy Analyzer operates in a way that is completely
consistent with the default flavor of the entire product -- which is OnBarClose.
That is, both users and programmers have to go out of their way to understand
and change Calculate to something other than the default OnBarClose. This is
a consistent experience throughout the product.
My point is, you can go pretty far with NinjaTrader (very far indeed) with out
ever having to know or care or understand that Calculate even exists, much less
what it does. Especially the truly esoteric advanced details of what it does when
working with it inside NinjaScript.
My last defensive comment is this: rookies do not get a pass. They have to read
documentation and study the NinjaTrader product's advanced features in order to
properly use those advanced features. If you're talking NinjaScript, same thing.
NinjaScript is not a toy. It is not a kiddie language, an afterthought, or a throw
away topic. It is a huge and very complex framework, with very deep roots that
are internal and mostly hidden from view. The exposed portions that we see are
like small tropical islands popping up from a massive underwater sea floor.
And that ocean floor is huge. It's called Microsoft .NET and the C# programming
language, neither of which are toys either.
Sorry, let me take a breath ...
If someone does something 'wrong', I'm not exactly sure I can immediately
accept that Strategy Analyzer is at fault, or that it should have protected the
user from doing it the 'wrong' way. I mean, the number of 'wrong' ways a
user can do something in the NinjaScript framework is quite huge.
Programming is a very serious skill. It can require years and years of
study, and even more years of practice. The C# language is no different.
Just my 2˘.
- Likes 3
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by LawrenHom, Today, 10:45 PM
|
0 responses
3 views
0 likes
|
Last Post
by LawrenHom
Today, 10:45 PM
|
||
Started by love2code2trade, Yesterday, 01:45 PM
|
4 responses
28 views
0 likes
|
Last Post Today, 10:31 PM | ||
Started by funk10101, Today, 09:43 PM
|
0 responses
7 views
0 likes
|
Last Post
by funk10101
Today, 09:43 PM
|
||
Started by pkefal, 04-11-2024, 07:39 AM
|
11 responses
37 views
0 likes
|
Last Post
by jeronymite
Today, 09:37 PM
|
||
Started by bill2023, Yesterday, 08:51 AM
|
8 responses
44 views
0 likes
|
Last Post
by bill2023
Today, 09:27 PM
|
Comment