• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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?
    Patrick H.NinjaTrader Customer Service

    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?
        Patrick H.NinjaTrader Customer Service

        Comment


          #5
          I got it taken care of, thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by sun0781, Today, 05:02 PM
          0 responses
          6 views
          0 likes
          Last Post sun0781
          by sun0781
           
          Started by ronhb107, 09-12-2019, 10:09 AM
          4 responses
          41 views
          0 likes
          Last Post Mr.Trader  
          Started by rwilliam, Today, 03:55 PM
          0 responses
          3 views
          0 likes
          Last Post rwilliam  
          Started by asmmbillah, Today, 03:42 PM
          2 responses
          7 views
          0 likes
          Last Post asmmbillah  
          Started by NT-Roland, Today, 03:25 PM
          0 responses
          7 views
          0 likes
          Last Post NT-Roland  
          Working...
          X