Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 Accessing ChartStyleType?

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

    NT8 Accessing ChartStyleType?

    How do I access the "ChartStyleType" programmatically? I would like to set some conditions on plotting based on the type of bars plotted eg. HLC, Candlestick etc.

    eg.

    Code:
    [INDENT]if (ChartBars.Properties.ChartStyleType == ChartStyleType.CandleStick)
    {[INDENT]do something..........
    [/INDENT]}
    [/INDENT]
    This does not work. I remember reading a thread where this is not possible at present. Is that correct? It would be very useful if it were possible, as I do not see another way around it other than manual selection by the user. Hmmmm.......

    Thanks in advance.

    #2
    Hello Sim22,

    Thanks for your post.

    You can access ChartStyleType. Please see the helpguide here: http://ninjatrader.com/support/helpG...tstyletype.htm

    Comment


      #3
      I could be wrong but I think that is to register a new Chart style type.
      A enum value which represents the ChartStyle to be registered.
      I have done this with my new chart style type but I have made indicators which should be used with the new chart style type. Therefore I need to "Get" not "Set" the chart style type.

      Thank you.

      Comment


        #4
        Hello Sim22,

        Thanks for your post.

        You are correct.

        I tested your original post code and I find that it does detect when the chart is set to candlestick.

        Code:
        if (ChartBars.Properties.ChartStyleType == ChartStyleType.CandleStick)
           {
            //do something
           }

        Comment


          #5
          Don't know what happened there....... sorry.

          There is one thing I have learned from this..... to use "Print" more often

          Code:
          [INDENT]Print(ChartBars.Properties.ChartStyleType);
          [/INDENT]
          Last edited by Sim22; 10-29-2015, 02:14 AM.

          Comment


            #6
            For anyone following this thread:

            If you wish to access the integer "reserved enumeration value" of the ChartStyle (or any other default ChartStyle) currently on your chart, just use "(int)".

            Example:

            Code:
            if ((int) ChartBars.Properties.ChartStyleType <= 1) // Boxes and Candlesticks
            {
                // ..... if my bars are styled as Candlesticks or Boxes then do something
            }
            else if ((int) ChartBars.Properties.ChartStyleType == 4541) // example custom style
            {
                // ..... if my bars are styled as "myCustomStyle" then do something
            }
            else
            {
                 //.....do something else
            }
            Just make sure you place '(int)' in front.
            Last edited by Sim22; 01-04-2016, 06:30 PM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            579 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            334 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            551 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X