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 Hwop38, 05-04-2026, 07:02 PM
                  0 responses
                  174 views
                  0 likes
                  Last Post Hwop38
                  by Hwop38
                   
                  Started by CaptainJack, 04-24-2026, 11:07 PM
                  0 responses
                  331 views
                  0 likes
                  Last Post CaptainJack  
                  Started by Mindset, 04-21-2026, 06:46 AM
                  0 responses
                  252 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by M4ndoo, 04-20-2026, 05:21 PM
                  0 responses
                  356 views
                  0 likes
                  Last Post M4ndoo
                  by M4ndoo
                   
                  Started by M4ndoo, 04-19-2026, 05:54 PM
                  0 responses
                  183 views
                  0 likes
                  Last Post M4ndoo
                  by M4ndoo
                   
                  Working...
                  X