Announcement

Collapse
No announcement yet.

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.

    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

        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?

            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);

                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 CarlTrading, 03-31-2026, 09:41 PM
                  1 response
                  153 views
                  1 like
                  Last Post NinjaTrader_ChelseaB  
                  Started by CarlTrading, 04-01-2026, 02:41 AM
                  0 responses
                  89 views
                  1 like
                  Last Post CarlTrading  
                  Started by CaptainJack, 03-31-2026, 11:44 PM
                  0 responses
                  133 views
                  2 likes
                  Last Post CaptainJack  
                  Started by CarlTrading, 03-30-2026, 11:51 AM
                  0 responses
                  127 views
                  1 like
                  Last Post CarlTrading  
                  Started by CarlTrading, 03-30-2026, 11:48 AM
                  0 responses
                  107 views
                  0 likes
                  Last Post CarlTrading  
                  Working...
                  X