Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

BuySell Volume Plots Question

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

    BuySell Volume Plots Question

    Hi guys, I've attached a small indicator that shows BuySellVolume difference. It works fine, except I made a modification. Here's a pic of the result I get https://www.screencast.com/t/d0eIFCIDe7U

    The problem is the Sell Volume keeps plotting even when it's time for the BuyVolume to plot. The original code
    Code:
     BuySellDiff[1] = buys - sells;
    works fine, So I tried to add 2 separate plots, if you can look at the indicator and see what is going on. Very small code.
    Code:
     if (BuySellDiff[1] > 0)
    {
    PlotBrushes[0][1] = Brushes.Green;
    //DGMOD
    BuyVol[1] = BuySellDiff[1] ;
    SellVol[1] = 0;
    }
    else
    {
    PlotBrushes[0][1] = Brushes.Red;
    //DGMOD
    BuyVol[1] = 0;
    SellVol[1] = BuySellDiff[1] ;
    }
    Please help if you can. I literally can't see anything wrong with this, yet I can't get SellVol[plot] to stay @ 0 value whenever the BuySellDiff[plot] > 0;
    Attached Files

    #2
    Hello ginx10k,

    Thank you for your post.

    Your issue doesn't appear to be in that section of the code, but rather this part:

    Code:
     if (BuySellDiff[0] > 0) // update intrabar
    {
    PlotBrushes[0][0] = Brushes.Green;
    
    //DGMOD:
    BuyVol[0] = BuySellDiff[0] ;
    [B]SellVol[1] = 0;[/B]
    }
    else
    {
    PlotBrushes[0][0] = Brushes.Red;
    
    //DGMOD:
    [B]SellVol[1] = BuySellDiff[1] ;[/B]
    BuyVol[0] = 0;
    }
    When you're updating intrabar, you're updating the previous bar's SellVol the the previous bar's BuySellDiff if the current bar's BuySellDiff is negative and setting it to 0 if the current BuySellDiff is negative. Changing this to the following should yield the behavior you're expecting:

    Code:
     if (BuySellDiff[0] > 0) // update intrabar
    {
    PlotBrushes[0][0] = Brushes.Green;
    
    //DGMOD:
    BuyVol[0] = BuySellDiff[0] ;
    [B]SellVol[0] = 0;[/B]
    }
    else
    {
    PlotBrushes[0][0] = Brushes.Red;
    
    //DGMOD:
    [B]SellVol[0] = BuySellDiff[0] ;[/B]
    BuyVol[0] = 0;
    }
    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      . NinjaTrader_Kate, thank you so much, I can't believe I didn't see that. It works now. Much appreciated!!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by kaywai, 09-01-2023, 08:44 PM
      5 responses
      602 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by xiinteractive, 04-09-2024, 08:08 AM
      6 responses
      22 views
      0 likes
      Last Post xiinteractive  
      Started by Pattontje, Yesterday, 02:10 PM
      2 responses
      20 views
      0 likes
      Last Post Pattontje  
      Started by flybuzz, 04-21-2024, 04:07 PM
      17 responses
      230 views
      0 likes
      Last Post TradingLoss  
      Started by agclub, 04-21-2024, 08:57 PM
      3 responses
      17 views
      0 likes
      Last Post TradingLoss  
      Working...
      X