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!
See more
See less

Partner 728x90

Collapse

Testing for a certain indicator pen color

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

    Testing for a certain indicator pen color

    I'm testing for a certain pen color in my indicaor script. I get a compile error when I use either of the following code.

    if (Plots[0].Pen.Color == Color.Lime)

    or

    if(Plots[0].Pen.Color.Lime == True)


    How can I test to see if the color of my indicator plot is lime?

    Thanks;

    #2
    Hi Drummer,

    There's unfortunately not a supported property you can read from to get the color of an indicator plot for a particular bar.

    If you change plot color by assigning PlotColors to a color value, then you could use that. You're then reading the value you assigned for this property.
    Print(PlotColors[0][0].ToString());
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply.

      If I have the same indicator loaded twice for the same chart, is there any way I can determine that there is more than one instance of the indicator on the chart, within the indicator code?

      Example:

      if(this indicator is loaded more than once within the same chart and on the same panel)
      {
      do Something
      }

      If I had the Simple MA loaded twice in the same chart, with different parameters and both displayed on the same panel, how could I have some differently functionality between the two (like write text for one and different text for the other) within the script?


      Thanks

      Comment


        #4
        This is just not possible in our framework. You apply an instance of an indicator to your chart, and there is no communication possible among multiple instances of this indicator.

        To get different functionality you would need to develop different indicators. You could also code some control so that it can do different things depending on user input selection, like a bool or enum input. This sample can help with this idea, by setting a MA plot differently depending on the input selection made.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Thank you for your reply.

          One more idea; is it posible for a script to know if more than one indicator is loaded on a chart?

          Comment


            #6
            That is not currently possible in our framework.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Is there a list in document form, of all the methods available to ninjascript like I see when intellisense tries to complete syntax for me?

              Comment


                #8
                You can find an alphabetical reference of NinjaScript methods at the link below.
                JasonNinjaTrader Customer Service

                Comment


                  #9
                  that reference has A LOT of methods missing that I have found using intellisense. Ex; the methods for the Indicator class, the chart control class, the instrument class, the dataseries class....

                  Comment


                    #10
                    That's true. There are some items you can access and use that are not documented or supported. You could check out this thread to get an introduction to some undocumented tips and tricks.

                    Ryan M.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by DanielSanMartin, Yesterday, 02:37 PM
                    2 responses
                    12 views
                    0 likes
                    Last Post DanielSanMartin  
                    Started by DJ888, 04-16-2024, 06:09 PM
                    4 responses
                    12 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by terofs, Today, 04:18 PM
                    0 responses
                    11 views
                    0 likes
                    Last Post terofs
                    by terofs
                     
                    Started by nandhumca, Today, 03:41 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post nandhumca  
                    Started by The_Sec, Today, 03:37 PM
                    0 responses
                    3 views
                    0 likes
                    Last Post The_Sec
                    by The_Sec
                     
                    Working...
                    X