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 stafe, 04-15-2024, 08:34 PM
|
9 responses
41 views
0 likes
|
Last Post Today, 10:25 AM | ||
Started by frslvr, 04-11-2024, 07:26 AM
|
7 responses
111 views
1 like
|
Last Post
by caryc123
Today, 10:17 AM
|
||
Started by rocketman7, Today, 09:41 AM
|
3 responses
8 views
0 likes
|
Last Post Today, 10:07 AM | ||
Started by traderqz, Today, 09:44 AM
|
2 responses
5 views
0 likes
|
Last Post Today, 10:00 AM | ||
Started by rocketman7, Today, 02:12 AM
|
7 responses
31 views
0 likes
|
Last Post Today, 09:23 AM |
Comment