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

Two line in the same window of indicator

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

    Two line in the same window of indicator

    Dear Forum, I made a simple indicator. In the output window all is ok....but if I would plot in a separate window below the graph I can plot only one line but I need 2 or more line.

    The code that I use is:

    Code:
     protected override void Initialize()
            {
                CalculateOnBarClose	= true;
                Overlay				= false;
                PriceTypeSupported	= false;
    			
    			Add(new Plot(Color.Green, "Delta"));
    			Add(new Plot(Color.DarkViolet, "Avg"));
    						
    			Add(new Line(Color.DarkViolet, 0, "Zero line"));
    			
            }
    Code:
    Value.Set(a-b);
    			
    			Avg.Set(a);
    The error is http://clip2net.com/s/67GQkA

    If I Comment the line like this....all work well but with only one line plotted:
    Code:
    Value.Set(a-b);
    			
    			//Avg.Set(a);
    Tnx to all

    #2
    How would your properties section of the script look? Is a public property for the plots as well defined and linked to the needed Values series? It does not look that way from the error message seen.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      How would your properties section of the script look? Is a public property for the plots as well defined and linked to the needed Values series? It does not look that way from the error message seen.
      I have made screen because this region is Empty

      Comment


        #4
        Right, that's exactly what I meant. For the setup needed please have a look at the Stochastics indicator shipped with NT.

        With setting a value to the Value series this would be expected to work nonetheless since that is always present and the main indicator value. However if you want to custom define how those values are visualized you would need Plots and those need to be linked in the properties then to your desired underlying value series like the Stochastics will show.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          Right, that's exactly what I meant. For the setup needed please have a look at the Stochastics indicator shipped with NT.

          With setting a value to the Value series this would be expected to work nonetheless since that is always present and the main indicator value. However if you want to custom define how those values are visualized you would need Plots and those need to be linked in the properties then to your desired underlying value series like the Stochastics will show.
          Ok many thanks for Help...I will made test immediatly.

          Tnx for now ....very fast and very best

          Comment


            #6
            I have added that
            Code:
               #region Properties
            		
            		[Browsable(false)]
            		[XmlIgnore()]
            		public DataSeries D
            		{
            			get { return Values[0]; }
            		}
            
            		/// <summary>
            		/// Gets the slow K value.
            		/// </summary>
            		[Browsable(false)]
            		[XmlIgnore()]
            		public DataSeries K
            		{
            			get { return Values[1]; }
            		}
            		
                    #endregion
            and now I have modified also that
            Code:
             protected override void Initialize()
                    {
                        CalculateOnBarClose	= true;
                        Overlay				= false;
                        PriceTypeSupported	= false;
            			
            			Add(new Plot(Color.Green, "Delta"));
            			Add(new Plot(Color.DarkViolet, "D"));
            						
            			Add(new Line(Color.DarkViolet, 0, "Zero line"));
            			
                    }
            and
            Code:
            Value.Set(a-b);
            			
            			K.Set(a);
            but I see nothing on the window BELOW. How is the error in the proprety?

            Comment


              #7
              Please add something like that your Initialize() as well -

              Add(new Plot(Color.DarkViolet, "K"));

              Or replace K.Set(a); with Values[1].Set(a);
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Bertrand View Post
                Please add something like that your Initialize() as well -

                Add(new Plot(Color.DarkViolet, "K"));

                Or replace K.Set(a); with Values[1].Set(a);
                Ok I will test now...many thanks. Now I am understanding something ....tnx.
                I will post results

                Comment


                  #9
                  Sounds good, please keep us updated ketron82.
                  BertrandNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by sidlercom80, 10-28-2023, 08:49 AM
                  170 responses
                  2,271 views
                  0 likes
                  Last Post sidlercom80  
                  Started by Irukandji, Yesterday, 02:53 AM
                  2 responses
                  17 views
                  0 likes
                  Last Post Irukandji  
                  Started by adeelshahzad, Today, 03:54 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post adeelshahzad  
                  Started by CortexZenUSA, Today, 12:53 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post CortexZenUSA  
                  Started by CortexZenUSA, Today, 12:46 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post CortexZenUSA  
                  Working...
                  X