Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Volume Question

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

    Volume Question

    Hello,

    I'm almost embarrassed to post this because it seems so easy but somehow it doesn't work.
    (I checked in the Ninja Help section as well and the syntax regarding volume is similar).

    Basically I want Ninja to draw a diamond below a (green) bar IF it has 30% higher volume than the previous one.
    Here's my code (it compiles ok but nothing happens).

    if (Volume[0] > Volume[1]*1.3)
    {
    DrawDiamond("Long" + CurrentBar, false, 0, Low[0]- 2*(TickSize), Color.Black);
    }

    Any pointers as to why it doesn't work would be much appreciated.

    Thanks

    #2
    Are you using a custom method for drawing the diamond? The correct syntax should be following:

    Code:
    Draw[U][B].[/B][/U]Diamond([U][B]this[/B][/U], "Long" + CurrentBar, false, 0, Low[0] - 2 * TickSize, [U][B]Brushes[/B][/U].Black);
    https://ninjatrader.com/support/helpGuides/nt8//draw_diamond.htm
    Last edited by @tmc_; 11-20-2021, 10:18 AM.

    Comment


      #3
      Hi @tmc_

      Thanks for your reply. Actually the drawing part isn’t the issue, it works well when used with other conditions. It’s the volume part I’m having trouble getting right.
      (I’m still using Ninja V7)

      Thanks

      Comment


        #4
        Originally posted by laocoon View Post
        Hello,

        I'm almost embarrassed to post this because it seems so easy but somehow it doesn't work.
        (I checked in the Ninja Help section as well and the syntax regarding volume is similar).

        Basically I want Ninja to draw a diamond below a (green) bar IF it has 30% higher volume than the previous one.
        Here's my code (it compiles ok but nothing happens).

        if (Volume[0] > Volume[1]*1.3)
        {
        DrawDiamond("Long" + CurrentBar, false, 0, Low[0]- 2*(TickSize), Color.Black);
        }

        Any pointers as to why it doesn't work would be much appreciated.

        Thanks
        your syntax looks correct but since you refer to value of 1 bar back, make sure you have enough bar on your chart
        --
        protected override void OnBarUpdate()
        {

        if (CurrentBar < 2)
        return;

        Comment


          #5
          Originally posted by nkhoi View Post

          your syntax looks correct but since you refer to value of 1 bar back, make sure you have enough bar on your chart
          --
          protected override void OnBarUpdate()
          {

          if (CurrentBar < 2)
          return;
          Brilliant! Working like a charm now.
          Thanks so much!

          Comment

          Latest Posts

          Collapse

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