Is there a way to access the Master Instrument TickSize value for the instrument in OnStateChange() when creating a custom BarsType?
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
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.
The BarsPeriod has an Instrument object to get the TickSize.
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.
Chelsea 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 kevinenergy, 02-17-2023, 12:42 PM
|
117 responses
2,766 views
1 like
|
Last Post
by jculp
Today, 12:59 PM
|
||
Started by Mongo, Today, 11:05 AM
|
5 responses
15 views
0 likes
|
Last Post Today, 12:58 PM | ||
Started by SightCareAubetter, Today, 12:55 PM
|
0 responses
3 views
0 likes
|
Last Post Today, 12:55 PM | ||
Started by traderqz, Today, 12:06 AM
|
8 responses
16 views
0 likes
|
Last Post
by traderqz
Today, 12:51 PM
|
||
Started by SightCareAubetter, Today, 12:50 PM
|
0 responses
2 views
0 likes
|
Last Post Today, 12:50 PM |
Comment