Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Adding BarSeries
Collapse
X
-
Adding BarSeries
How to add a BarSeries on a strategy the same with the primary BarSeries? For example, if I set the strategy to run on a Range chart on CL then I would like also the strategy itself a bar series that is a Range. If I set it to run on 2 Minute time frame then the strategy automatically add itself a Minute Bar Series with different period like 5.Tags: None
-
Hello edward_bell,
Thanks for your post.
You can get the bar type with BarsPeriod.Id and the interval with BarsPeriod.Value.
For example:
Code:Add(Instrument.FullName, BarsPeriod.Id, BarsPeriod.Value+4);
BarsPeriod.Id will return the bar type, such as minute or range. BarsPeriod.Value will return the interval (as an integer) to which you can add or subtract from.
Below is a link to the help guide on BarsPeriod.
http://www.ninjatrader.com/support/helpGuides/nt7/barsperiod.htmChelsea B.NinjaTrader Customer Service
-
Originally posted by NinjaTrader_ChelseaB View PostHello edward_bell,
Thanks for your post.
You can get the bar type with BarsPeriod.Id and the interval with BarsPeriod.Value.
For example:
Code:Add(Instrument.FullName, BarsPeriod.Id, BarsPeriod.Value+4);
BarsPeriod.Id will return the bar type, such as minute or range. BarsPeriod.Value will return the interval (as an integer) to which you can add or subtract from.
Below is a link to the help guide on BarsPeriod.
http://www.ninjatrader.com/support/helpGuides/nt7/barsperiod.htm
Comment
-
koganam,
You are correct. The help guide does say not to use this in Initialize().
This code would be an unsupported method as there are some instances that can cause NinjaTrader to crash.
However, for what edward_bell is trying to accomplish this should work ok. (I did test this first btw)
Just to re-iterate this is unsupported. The only supported method would be to hard code the secondary series.Chelsea B.NinjaTrader Customer Service
Comment
-
This method works but it makes Ninja to crash or doesn't good to any Dataseries. It will make the indicator so slow. Is there another way?
Comment
-
-
Hello edward_bell,
Below is an example of hard coding an added data series.
Add("ES 09-13", PeriodType.Minute, 10);
Also here is a link to the help guide on the Add() function.
http://www.ninjatrader.com/support/h...s/nt7/add3.htmChelsea B.NinjaTrader Customer Service
Comment
-
It is just the same with Add(Instrument.FullName, BarsPeriods[0].Id, 4);. It will will make the indicator too slow or even the chart will freeze.
Comment
-
Yes I placed it on the Initialize() section of the code and the primary bar series is based on Days. I have put 3 bar series and the chart will freeze or even adding only 1.
Comment
-
-
Comment
-
Hello edward_bell,
This means that you must download 30 days of tick data for this instrument.
On my machine this takes approximately 38 seconds. Is this taking much longer for you?
Also, I am confused. You mentioned in post #11 that you have a Day interval for the primary data series on the chart.
Have you changed this?Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by WHICKED, 03-27-2024, 12:33 PM
|
4 responses
41 views
0 likes
|
Last Post Today, 12:28 AM | ||
Started by f.saeidi, Today, 12:12 AM
|
0 responses
3 views
0 likes
|
Last Post
by f.saeidi
Today, 12:12 AM
|
||
Started by Conall, Today, 12:06 AM
|
0 responses
5 views
0 likes
|
Last Post
by Conall
Today, 12:06 AM
|
||
Started by proptradingshop, 03-21-2024, 09:50 AM
|
6 responses
27 views
0 likes
|
Last Post Today, 12:02 AM | ||
Started by mly916, Yesterday, 09:48 PM
|
1 response
14 views
0 likes
|
Last Post Yesterday, 11:54 PM |
Comment