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

Value.Set() without plotting?

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

    Value.Set() without plotting?

    Hi

    Is it possible to use a DataSeries property and Value.Set() in an indicator without drawing a plot line?

    My indicator colours bars (blue or red) according to a condition and a plot line is not required. However, I would like the condition result to be accessible to calling indicators and strategies.

    After the indicator was created without any plots, I added a DataSeries property, but no Add(), and I use Value.Set(1) or Value.Set(-1) for each condition. The condition values are now accessible to a calling indicator.

    However, when this inidicator is applied to a chart, a plot line appears, with values -1 & +1. There are no inputs available for the plot line, so I can't suppress it manually. Can I suppress the plot line programmatically?

    Cheers
    Tony

    #2
    You've removed and reapplied the indicator to the chart?

    I've got an indicator with a lot of data series and only 2 of 8 are plotted... I would suspect everything would still work if I removed the 2 Adds()...

    Restarted NT???




    Originally posted by Jellybean View Post
    Hi

    Is it possible to use a DataSeries property and Value.Set() in an indicator without drawing a plot line?

    My indicator colours bars (blue or red) according to a condition and a plot line is not required. However, I would like the condition result to be accessible to calling indicators and strategies.

    After the indicator was created without any plots, I added a DataSeries property, but no Add(), and I use Value.Set(1) or Value.Set(-1) for each condition. The condition values are now accessible to a calling indicator.

    However, when this inidicator is applied to a chart, a plot line appears, with values -1 & +1. There are no inputs available for the plot line, so I can't suppress it manually. Can I suppress the plot line programmatically?

    Cheers
    Tony

    Comment


      #3
      Originally posted by Jellybean View Post
      Hi

      Is it possible to use a DataSeries property and Value.Set() in an indicator without drawing a plot line?

      My indicator colours bars (blue or red) according to a condition and a plot line is not required. However, I would like the condition result to be accessible to calling indicators and strategies.

      After the indicator was created without any plots, I added a DataSeries property, but no Add(), and I use Value.Set(1) or Value.Set(-1) for each condition. The condition values are now accessible to a calling indicator.

      However, when this inidicator is applied to a chart, a plot line appears, with values -1 & +1. There are no inputs available for the plot line, so I can't suppress it manually. Can I suppress the plot line programmatically?

      Cheers
      Tony
      Values is just another identifier for the Plots Array. What is called a reserved word. If you assign to Values, the Plot is simply assumed, and used silently. In fact, many of the shipping NT indicators do not declare a Plot, and just assign to Values[0], or even Value.

      Just expose the DataSeries itself directly as public, assign to it, and you can access if from wherever you wish.

      Heck, I even sometimes use it as a mechanism to return data from the Strategy to the Indicator!

      Comment


        #4
        Thanks for your comment, Sledge.
        I did try removing and re-applying the indicator and also restarting NT, but it stayed the same.
        Cheers
        Tony

        Comment


          #5
          Thanks, Koganam

          I appreciate your help with this. It worked well with the right access available to other strategies & indicators.

          However, when I try to save the Workspace, I get this error:
          "Indicator 'NinjaTrader.Indicator.BBVColours' could not be serialized." I've obviously missed something. Can you help further?

          I've just declared
          public DataSeries Direction;

          In Initialize()
          Direction = new DataSeries( this );

          In OnBarUpdate()
          if( ... )
          Direction[0] = -1;
          else
          Direction[0] = 1;


          I access it from another indicator this way.
          bool result = BBVColours( Close, signalATRMult, aTRPer ).Direction[1] < 0 && BBVColours( Close, signalATRMult, aTRPer ).Direction[0] > 0;

          Cheers
          Tony

          Comment


            #6
            Originally posted by Jellybean View Post
            Thanks, Koganam

            I appreciate your help with this. It worked well with the right access available to other strategies & indicators.

            However, when I try to save the Workspace, I get this error:
            "Indicator 'NinjaTrader.Indicator.BBVColours' could not be serialized." I've obviously missed something. Can you help further?

            I've just declared
            public DataSeries Direction;

            In Initialize()
            Direction = new DataSeries( this );

            In OnBarUpdate()
            if( ... )
            Direction[0] = -1;
            else
            Direction[0] = 1;


            I access it from another indicator this way.
            bool result = BBVColours( Close, signalATRMult, aTRPer ).Direction[1] < 0 && BBVColours( Close, signalATRMult, aTRPer ).Direction[0] > 0;

            Cheers
            Tony
            Where and how did you expose the DataSeries Direction's properties?

            Comment


              #7
              Hi Koganam

              Thanks for your guiding question!

              I had just declared public DataSeries Direction, then accessed it as a member of the indicator.
              BBVColours( Close, signalATRMult, aTRPer ).Direction[1], for example.

              However, I have fixed the problem by providing a property for access to it. I now use:
              private DataSeries direction;

              and provide access with:
              public DataSeries Direction
              {
              get { return direction; }
              }

              Thanks again for your help.

              Cheers
              Tony

              Comment


                #8
                Originally posted by Jellybean View Post
                Hi Koganam

                Thanks for your guiding question!

                I had just declared public DataSeries Direction, then accessed it as a member of the indicator.
                BBVColours( Close, signalATRMult, aTRPer ).Direction[1], for example.

                However, I have fixed the problem by providing a property for access to it. I now use:
                private DataSeries direction;

                and provide access with:
                public DataSeries Direction
                {
                get { return direction; }
                }

                Thanks again for your help.

                Cheers
                Tony
                Well, that was exactly what I was suspecting. I am glad that you fixed it on your own.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by timmbbo, Today, 08:59 AM
                1 response
                2 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by KennyK, 05-29-2017, 02:02 AM
                2 responses
                1,279 views
                0 likes
                Last Post marcus2300  
                Started by fernandobr, Today, 09:11 AM
                0 responses
                2 views
                0 likes
                Last Post fernandobr  
                Started by itrader46, Today, 09:04 AM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by bmartz, 03-12-2024, 06:12 AM
                5 responses
                33 views
                0 likes
                Last Post NinjaTrader_Zachary  
                Working...
                X