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

only one plot displaying

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

    only one plot displaying

    why is that only one line plot is displaying with this code:

    protected override void OnBarUpdate()
    {

    if(CurrentBar<(Period*2))
    {
    return;
    }

    double currHigh=0;
    double currLow=0;
    double currTotal=0;
    double currRange=0;
    double prevHigh=0;
    double prevLow=0;
    double prevTotal=0;
    double prevRange=0;

    for(int i=0;i<Period;i++)
    {
    currHigh=High[i];
    currLow=Low[i];
    prevHigh=High[i+3];
    prevLow=Low[i+3];
    currTotal+=(currHigh-currLow);
    prevTotal+=(prevHigh-prevLow);
    }

    currRange=(currTotal/Period);
    prevRange=(prevRange/Period);

    CurrAvgRng.Set(currRange);
    PrevAvgRng.Set(prevRange);

    }
    Last edited by d.allen101; 11-26-2009, 10:41 AM.

    #2
    Please post your Initialize() as well.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      protected override void Initialize()
      {
      Add(new Plot(Color.FromKnownColor(KnownColor.Turquoise), PlotStyle.Line, "CurrAvgRng"));
      Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "PrevAvgRng"));
      CalculateOnBarClose = true;
      Overlay = false;
      PriceTypeSupported = false;
      }

      Comment


        #4
        Are those setup with the indicator wizard, so pointing to two different Values series in the 'Properties' section of the code?

        Thanks
        BertrandNinjaTrader Customer Service

        Comment


          #5
          yes, both plots are in the Values collection. Values[0] and Values[1] of DataSeries data type and they are in the properties of the class

          Comment


            #6
            Please apply the indicator and open the databox to compare the plot value, perhaps they are the same so you couldn't tell visually?
            BertrandNinjaTrader Customer Service

            Comment


              #7
              CurrAvgRng.Set(currRange) has a value. PrevAvgRng(prevRange) value is 0

              Comment


                #8
                You have defined -

                currRange=(currTotal/Period);
                prevRange=(prevRange/Period);

                Shouldn't this be ? -

                currRange=(currTotal/Period);
                prevRange=(prevTotal/Period);
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Hey Bertrand, don't worry about...I'd rather figure it out myself, that's the best way for me to learn. But thanks anyway!

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by swestendorf, Today, 11:14 AM
                  2 responses
                  5 views
                  0 likes
                  Last Post NinjaTrader_Kimberly  
                  Started by xiinteractive, 04-09-2024, 08:08 AM
                  4 responses
                  12 views
                  0 likes
                  Last Post xiinteractive  
                  Started by Mupulen, Today, 11:26 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post Mupulen
                  by Mupulen
                   
                  Started by Sparkyboy, Today, 10:57 AM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by TheMarlin801, 10-13-2020, 01:40 AM
                  21 responses
                  3,917 views
                  0 likes
                  Last Post Bidder
                  by Bidder
                   
                  Working...
                  X