Is there a way to access the Master Instrument TickSize value for the instrument in OnStateChange() when creating a custom BarsType?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Master Instrument TickSize in BarsType
Collapse
X
-
Hello Zeos6,
In OnStateChange when State.DataLoaded or later you can get the bars period of any added series.
Below are public links to the help guide.
https://ninjatrader.com/support/help...arsperiods.htm
https://ninjatrader.com/support/help...barsperiod.htm
The BarsPeriod has an Instrument object to get the TickSize.
https://ninjatrader.com/support/help...t_ticksize.htm
BarsPeriods[0].Instrument.MasterInstrument.TickSize.Chelsea B.NinjaTrader Customer Service
-
Thank you for the reply ChelseaB. I appreciate your response but unfortunately it misses the point of my question. I am painting a custom bar type.The tick size for the instrument is available in the db even before any bars are painted. I would like to access the value of the tick size stored in the db in State.Configure before any bars are built.As far as I am aware, I cannot use Bars as no Bars exist yet; they haven't been built yet. So how do I access the tick size value stored in the db?
Comment
-
Hello Zeos6,
Thank you for specifying in which state you are wanting this value.
In State.Configure the bar and instrument is not yet available meaning you would need to get the instrument another way.
You could use
Cbi.Instrument.GetInstrument(string name)
Below is a public link to the help guide.
https://ninjatrader.com/support/help...instrument.htmChelsea B.NinjaTrader Customer Service
Comment
-
Hi ChelseaB.
Will try it out again. But is there a way to do this without explicitly typing in the name of the instrument as a string. I'd like the retrieve the name of the instrument without typing it in explicitly as I plan to use the code on a variety of instruments.
Comment
-
Hello Zeos6,
It depends on how you are getting this list of instruments.
If its coming from a text file, the text is going to be read as a string.
I guess it would be possible to have a static list of Instrument objects.
The primary bar, however, is not available in State.Configure. Meaning it would not be supported to use the Bars.Instrument until State.DataLoaded.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by southpacific001, 02-26-2021, 09:25 PM
|
13 responses
61 views
0 likes
|
Last Post
![]() |
||
Oco
by punkiy2111
Started by punkiy2111, Today, 05:22 PM
|
0 responses
2 views
0 likes
|
Last Post
![]()
by punkiy2111
Today, 05:22 PM
|
||
Started by secrettrader, Today, 03:36 PM
|
0 responses
8 views
0 likes
|
Last Post
![]()
by secrettrader
Today, 03:36 PM
|
||
Started by t3chn0, Today, 01:03 PM
|
1 response
11 views
0 likes
|
Last Post
|
||
Started by jleira, Today, 02:27 PM
|
0 responses
25 views
0 likes
|
Last Post
![]()
by jleira
Today, 02:27 PM
|
Comment