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 Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  598 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  343 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  103 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  556 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  555 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X