• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Display Message On Chart When Bar Type Properties Set Incorrectly

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

    Display Message On Chart When Bar Type Properties Set Incorrectly

    I have created a custom bar type and want to display a text message on the chart (instead of the bars) when the properties for the bar type are set incorrectly. I tried to do this with Draw.TextFixed, but that method is not available in BarTypes namespace. Any ideas on how I might go about doing this?

    #2
    Hello gregschr,

    I'm not certain this would be possible from a bar type.

    You could send a log message with an alert.

    To render text on the chart this would need to be done with a ChartStyle script in OnRender.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea! Using a ChartStyle makes sense.

      If I created a custom ChartStyle for the custom BarType, is there a way to set the custom ChartStyle as a default for the BarType? I know this can be done manually from the Data Series window by saving a preset. Is it also possible to do it in the code for the BarType?

      Comment


        #4
        Any thoughts on the followup question in my last post?

        Comment


          #5
          Hello gregschr,

          So the bar type would need to use an existing property as its own with SetPropertyName(). SetPropertyName() works for bar types as well and I've noted to our development to add this to the Bars Type section of the help guide.

          http://ninjatrader.com/support/helpG...opertyname.htm

          In the BarType file set DefaultChartStyle to your chart style script.
          DefaultChartStyle = (ChartStyleType) 80;

          Once the property is set, in the Chart Style's OnRender you have access to the Bars object.
          http://ninjatrader.com/support/helpG...e_onrender.htm
          http://ninjatrader.com/support/helpG.../chartbars.htm

          Then access the property from the bar object -> BarsPeriod.

          Print(chartBars.Bars.BarsPeriod.Value);

          And draw this using SharpDX.Direct2D1.RenderTarget.DrawText().
          http://ninjatrader.com/support/helpG...t_drawtext.htm
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Thanks Chelsea!

            That was exactly what I needed.

            I appreciate the detailed instructions and your help!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by akuntysh, Yesterday, 09:21 PM
            0 responses
            4 views
            0 likes
            Last Post akuntysh  
            Started by i2w8am9ii2, Today, 06:57 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Started by buzzripper, Today, 06:14 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_Ray  
            Started by sidviciousX, Today, 06:47 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_RyanS  
            Started by TazoTodua, Today, 07:17 AM
            0 responses
            3 views
            0 likes
            Last Post TazoTodua  
            Working...
            X