Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need some help

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

    Need some help

    I got this thing to plot, but the values were incorrect. I made some changes and broke it completely. The logic looks fine to me and it compiles OK, but it doesn't plot anything.

    Can you tell from this what's wrong?

    if (CurrentBar > activeBar)
    {
    previousVol = 0; // reset all variables
    buys = 0;
    sells = 0;
    activeBar = CurrentBar;
    }
    else
    {
    //Calculate the volume traded since the last update
    double tradeVol = previousVol == 0 ? Volume[0] : Volume[0] - previousVol;
    //Determine if the volume increase was on the bid or ask
    if (Close[0] >= GetCurrentAsk())
    buys += tradeVol;
    else if (Close[0] <= GetCurrentBid())
    sells += tradeVol;


    netVol = buys - sells; //Get the net volume
    previousVol = Volume[0]; //Update the volume
    }
    SpreadOpen.Set(0); //Want all bars to start at the zero line
    SpreadClose.Set(netVol); //The bar should track and close on the net volume
    SpreadHigh.Set(buys); // plot the total buy vol above the line
    SpreadLow.Set(-1*sells); //Plot the total sell vol below the line
    }

    #2
    Hello tiger45,

    Thank you for your post.

    When you add the indicator to the chart please go to the Log tab of the Control Center. Are there messages concerning the indicator? If so, what do they report?

    Comment


      #3
      Looks like two different ones:

      11/26/2014 3:01:57 PM Default Error on calling 'OnStartUp' method for indicator 'SpreadCandlesticks': Input series Period must be time-based (Minute,Day,Week,Month,Year,or Second).


      and

      11/26/2014 2:09:16 PM Default Error on plotting indicator 'SpreadCandlesticks'. Please check the 'OnBarUpdate' or the 'Plot' method: Overflow error.


      I've pieced together code from the SpreadCandlesticks indi and the BuySellVolume indi. Both of these indicators work on the volume chart individually, so there's something that I've changed or neglected.

      Thanks for your help.

      Comment


        #4
        Hello tiger45,

        Thank you for your response.

        Are you editing the SpreadCandlesticks? Or are you calling the SpreadCandlesticks in your code?

        Comment


          #5
          I got it taken care of, thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          571 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          331 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          549 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          549 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X