Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Access to NinjaTrader.NinjaScript.BarsTypes object from ChartStyle object

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Access to NinjaTrader.NinjaScript.BarsTypes object from ChartStyle object

    Hello.

    I have custom BarsTypes (say, NinjaTrader.NinjaScript.BarsTypes.MyBarType)and custom ChartStyle (say, NinjaTrader.NinjaScript.ChartStyles.MyChartStyle).
    I want to create public properties in MyBarsType to access them from MyChartStyle.



    Why do I need this: MyChartStyleshould paint bars according to internal data of MyBarsType.
    Why do I suppose it is possible: both instances run on same chart.
    Last edited by fx.practic; 04-03-2020, 01:27 PM.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    This works, but, is this legal and safe?
    PHP Code:
    BarsTypes.MyBarsType my_bars = chartBars.Bars.BarsSeries.BarsType as BarsTypes.MyBarsType;
    if( my_bars!= null )
    {
         Print( my_bars.Test_Prop );
    } 
    
    Last edited by fx.practic; 04-03-2020, 12:36 PM.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    Comment


      #3
      Hello fx.practic,

      Thanks for your question.

      This is essentially how the Volumetric Bars are referenced in a script to use their data access methods, and I would recommend the same for this case.

      I can't give specifics on how the data access methods are implemented in the Volumetric Bars as they are proprietary and closed source, but the fact that this BarsType offers additional public properties, and these properties are referenced the same way you are should give you enough confidence to move forward with what you are doing.

      For the thread's reference Volumetric Bar Data Access methods can be referenced here - https://ninjatrader.com/support/help...tric_bars2.htm

      I look forward to assisting.

      Comment


        #4
        Thank you, Jim.
        Now, after your confirmation, I feel much more confident.
        NT is highly flexible.
        fx.practic
        NinjaTrader Ecosystem Vendor - fx.practic

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        85 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        143 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        83 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        257 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        334 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X