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

Close[] High[] Low[] returning same value

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

    Close[] High[] Low[] returning same value

    Hi,

    I am working with a very very simple indicator, but High[0] Close[0] Low[0] seem to return the same value, Close[0]. I am sure that the data is not the problem because the candles are drawn correctly with different High and Low values.

    Did I do something wrong? I have attached a picture to show the point.

    protected override void Initialize()
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "High"));
    Add(new Plot(Color.FromKnownColor(KnownColor.Purple), PlotStyle.Line, "Close"));
    Add(new Plot(Color.FromKnownColor(KnownColor.Blue), PlotStyle.Line, "Low"));
    Overlay= false;
    }

    protected override void OnBarUpdate()
    {
    High.Set(High[0]+300);
    Close.Set(Close[0]+200);
    Low.Set(Low[0]+100);
    }
    Attached Files
    Last edited by usuallywin; 02-02-2013, 07:40 PM.

    #2
    It is even stranger with:

    High.Set(High[10]+300);
    Close.Set(Close[10]+200);
    Low.Set(Low[10]+100);
    Attached Files

    Comment


      #3
      Originally posted by usuallywin View Post
      Hi,

      I am working with a very very simple indicator, but High[0] Close[0] Low[0] seem to return the same value, Close[0]. I am sure that the data is not the problem because the candles are drawn correctly with different High and Low values.

      Did I do something wrong? I have attached a picture to show the point.

      protected override void Initialize()
      {
      Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "High"));
      Add(new Plot(Color.FromKnownColor(KnownColor.Purple), PlotStyle.Line, "Close"));
      Add(new Plot(Color.FromKnownColor(KnownColor.Blue), PlotStyle.Line, "Low"));
      Overlay= false;
      }

      protected override void OnBarUpdate()
      {
      High.Set(High[0]+300);
      Close.Set(Close[0]+200);
      Low.Set(Low[0]+100);
      }
      I am surprised that you got an output rather than throwing an exception and crashing. Your code is assigning values to the input DataSeries!

      IOW, the first thing that you need to do is change the name of your Plots, so that you are not assigning values to the input DataSeries. If you still have issues after that, another look might be warranted.

      Comment


        #4
        Thanks so much. Silly me.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Today, 06:40 PM
        0 responses
        2 views
        0 likes
        Last Post algospoke  
        Started by maybeimnotrader, Today, 05:46 PM
        0 responses
        6 views
        0 likes
        Last Post maybeimnotrader  
        Started by quantismo, Today, 05:13 PM
        0 responses
        6 views
        0 likes
        Last Post quantismo  
        Started by AttiM, 02-14-2024, 05:20 PM
        8 responses
        168 views
        0 likes
        Last Post jeronymite  
        Started by cre8able, Today, 04:22 PM
        0 responses
        8 views
        0 likes
        Last Post cre8able  
        Working...
        X