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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          78 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          40 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          63 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          63 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          54 views
          0 likes
          Last Post CarlTrading  
          Working...
          X