Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Color reflects relative value

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

    Color reflects relative value

    I am not understanding this yet.

    How would I get a plot to reference it's previous value?
    The following doesn't work.
    Should it be a dataseries?

    Code:
         protected override void Initialize()
            {
                Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Dot, "RSRed"));
                Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Dot, "RSGReen"));
                Add(new Plot(Color.FromKnownColor(KnownColor.Black), PlotStyle.Dot, "RSBlack"));
    		//	myDataSeries = new DataSeries(this);
                CalculateOnBarClose	= true;
                Overlay				= true;
                PriceTypeSupported	= false;
            }
     protected override void OnBarUpdate()
    	
    {double value = ((High[0]+Low[0]+Close[0])/3)
    	
    	 RSBlack.Set(value);
    	if( value(0) < value(1));
               RSRed.Set(value[0]);
    	if (value[0] > value[1]);
              RSGReen.Set(value[0]);
    ]
    ((

    #2
    Coloring still not right

    Code:
    		if(CurrentBar < 3) return;
    			
            	myDataSeries.Set(EMA(Typical,3)[0]);
    				
    	RSBlack.Set(myDataSeries[0]);
    	if( myDataSeries[0] < myDataSeries[1]);
               RSRed.Set(myDataSeries[0]);
    	if( myDataSeries[0] > myDataSeries[1]);
               RSGReen.Set(myDataSeries[0]);
       	Print("Values =  " + myDataSeries[0] + " Value 1  " + myDataSeries[1]);
    The above plots but everything is red. I am trying to get green and v occasionally black plots.
    Is print supposed to output to the Output window?

    Comment


      #3
      Print does print to the Output Window.

      I suspect you may have an error in your Control Center. What you are running into is probably the issue outlined in this article: http://www.ninjatrader-support.com/v...ead.php?t=3170
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        But it's plotting

        Hi
        But if it's plotting then can that be the issue?
        If I use the solution
        Code:
        if(CurrentBar < anynumber at all ) return;
        same plot - still all red but at different values ( so I assume the dataseries is operational - it's just the condition that doesn't seem to operate)

        Comment


          #5
          Then scroll down to your Properties region of your code. Do you have 3 plots created down there? For an example of how it should look you can try opening up the MACD indicator to compare code.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Yes 3 plots in the properties

            Code:
                    #region Properties
                    [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                    [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                    public DataSeries RSRed
                    {
                        get { return Values[0]; }
                    }
            
                    [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                    [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                    public DataSeries RSGReen
                    {
                        get { return Values[1]; }
                    }
            
                    [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                    [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                    public DataSeries RSBlack
                    {
                        get { return Values[2]; }
                    }
            
                    [Description("")]
                    [Category("Parameters")]
                    public int MyInput0
                    {
                        get { return myInput0; }
                        set { myInput0 = Math.Max(1, value); }
                    }
                    #endregion
                }

            Comment


              #7
              Ok Mindset. If you don't mind can you attach the complete indicator as a file I can test on my end with? Thanks.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                File attached

                Originally posted by NinjaTrader_Josh View Post
                Ok Mindset. If you don't mind can you attach the complete indicator as a file I can test on my end with? Thanks.
                Here is the file Josh - I am completely stumped and I know it will be something incredibly simple.
                Attached Files

                Comment


                  #9
                  Mindset,

                  I don't know what is wrong with this indicator file. I made a new one with relatively the same code and it works.

                  If you print out values from within your if-statements you will see all your conditions keep evaluating to true. Something wacky happened to that indicator. Try recreating the conditions in a new indicator. I have attached a slightly different version, but it works as expected.
                  Attached Files
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Wackiness continues

                    Ok Josh

                    Your indicator worked fine so I plugged in a little twist and I am back to the old problem - all balck dots.
                    The ONLY thing I have changed is the forumla here

                    Code:
                    {
                       
                    			
                    			if (CurrentBar < 1)
                    				return;
                    			
                    			if (EMA(EMA(Typical, 3), 3)[0] == (EMA(EMA(Typical, 3), 3)[1]));
                    				RSBlack.Set(EMA(EMA(Typical, 3), 3)[0]);
                    			
                    			if (EMA(EMA(Typical, 3), 3)[0] < (EMA(EMA(Typical, 3), 3)[1]));
                    				RSRed.Set(EMA(EMA(Typical, 3), 3)[0]);
                    
                    			if (EMA(EMA(Typical, 3), 3)[0] > (EMA(EMA(Typical, 3), 3)[1]));
                    				RSGreen.Set(EMA(EMA(Typical, 3), 3)[0]);
                            }
                    If I now go back to your code that also is all black dots - aargh!!!

                    if I delete and re import yours the colors all come back.

                    Comment


                      #11
                      Mindset,

                      I am out of ideas. Maybe please try reinstalling?

                      1. Uninstall NT6.5
                      2. Uninstall .NET 2.0
                      3. Clear internet browse cache
                      4. Reinstall .NET 2.0
                      4. Reinstall NT6.5

                      If that does not work please try an uninstall and reinstall while removing your My Documents\NinjaTrader 6.5 folder. BEWARE: You will lose ALL custom indicators, strategies, workspaces, data, etc. Back those up first if you want to keep them.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        new Nt on new machine

                        Same thing - is there someone who can maybe shed some light on this?

                        I have tried converting the variable to a dataseries in order to try and debug this.
                        The condition seems to be evaluating but the 2nd and 3rd plots are not plotting.
                        Values are all correct.
                        Attached Files
                        Last edited by Mindset; 10-20-2008, 08:40 AM. Reason: Add code

                        Comment


                          #13
                          Mindset,

                          Nobody has ever reported any issues with this before and it works just fine for you on my test reference. Maybe you are messing something up when you are programming, but I can't tell. Please use completely new indicators and program only in the areas as demonstrated by any of these tutorials: http://www.ninjatrader-support.com/H...verview25.html
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            Got it.

                            Finally.

                            I have no idea why it didn't work before. [Edit Actually I noticed that Josh's code did not have ";" at the end of each evaluation line. ]

                            Here is the final code for anyone that would like it.
                            I have tweaked it around a little more. It's a very useful indicator once you learn how to use it.
                            Attached Files
                            Last edited by Mindset; 10-20-2008, 09:47 AM.

                            Comment


                              #15
                              Hi Mindset,

                              Glad you got it resolved! If its not too much hassle for you, would you mind posting it on the File Sharing section of the forums? More people will be able to find it there.

                              Thanks for the contribution.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              612 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              355 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              105 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              561 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              564 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X