I need to plot calculated values on a chart, and StrategyPlot may be exactly what i need. Unfortunately it does not work during backtest (a rather strange limitation). Any solution to this issue?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Plotting custom dataseries during backtest
Collapse
X
-
Hello,
Thanks for the forum post.
This is the case unfortuantely, the only 2 workaround I can think of are switching to using a DrawObject to plot what you needed. your other option is to seperate out your logic into another indicator. Then Add(Indicator); in the strategy, you can do this as long as the strategyplot does not count on strategy data points. If what you need to plot can be calculated off the OHLC values on the bars than this is an option as well.
-Brett
-
Well, I figured out the DrawObject method, but a) it seems slow b) i can draw on the main chart only (and i want also use the indicator chart).
As far as the Add(Indicator); method is concerned, I'm not sure it'll work, since indicator's onBarUpdate() only has access to the "primary dataset". Am I right?
I'd like to draw custom indicators based on secondary datasets.
Comment
-
Well, there's a good explanation of how to calculate indicators on secondary data series (something like SMA(BarsArray[1], 1)).
However, i still have no idea how to plot this indicator.
Attempting to "Add(SMA(BarsArray[1], 1));" in "Initialize()" does not work as i get:
'BarsArray' property can't be accessed from within 'Initialize' method
Comment
-
This does not seem to work in a backtest mode, as i stated earlier:
1. In OnBarUpdate() of my custom indicator, BarsArray only has 1 main dataseries (BarsArray.Length = 1). For some reason the secondary data series is excluded
2. In OnBarUpdate() of the strategy itself BarsArray holds all dataseries (BarsArray.Length = 2), but CustomInd(0).Value.Set(SMA(BarsArray[1],20)[0]); does nothing as the indicator is not being plotted
Comment
-
All the multiseries logic is in the indicator, and the strategy just adds it. I've attached a couple scripts here if you want to see how it can work.
To import:
1. From the Control Center window select the menu File > Utilities > Import NinjaScript to open the Import NinjaScript dialog window
2. Select the file you want to import
3. Press the "Open" buttonRyan M.NinjaTrader Customer Service
Comment
-
OK, glad that worked for you and sorry for any confusion regarding the technique. I will forward your comments to our documentation team. This has been assigned tracking ID # 1449. Thank you for the feedback.Last edited by NinjaTrader_RyanM1; 01-24-2012, 02:39 PM.Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by idude, 11-09-2024, 09:12 AM
|
3 responses
16 views
0 likes
|
Last Post Today, 09:35 AM | ||
Started by Falke07, 11-03-2024, 07:43 AM
|
8 responses
42 views
0 likes
|
Last Post Today, 09:24 AM | ||
Started by noabai, Today, 03:32 AM
|
2 responses
13 views
0 likes
|
Last Post
by noabai
Today, 09:23 AM
|
||
Started by ToNovy, 11-08-2024, 10:36 AM
|
15 responses
64 views
0 likes
|
Last Post Today, 08:29 AM | ||
Started by steinberg123, Today, 04:33 AM
|
1 response
9 views
0 likes
|
Last Post Today, 08:11 AM |
Comment