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

BuySellVolume indicator

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

    BuySellVolume indicator

    I don't quite understand what is the rationale behind that indicator. In order to find out how it works, I modified the Initialize() code this way :
    protected override void Initialize()
    {
    Add(new Plot(new Pen(Color.Red, 2), PlotStyle.Square, "Sells"));
    Add(new Plot(new Pen(Color.Green, 2), PlotStyle.Square, "Buys"));
    CalculateOnBarClose = false;
    DisplayInDataBox = false;
    // PaintPriceMarkers = false;
    PlotsConfigurable = true;
    }

    I then opened a Time & Sales window to trace the trades and the pricemarkers which yielded to this figures :

    Time: Green trade: Red trade: Green pricemarker: Red pricemarker:
    18:53:16 start time 9719 980
    18:53:17 0 64 9783 1044
    18:53:19 11 21 9815 1065

    It looks like volume traded at a price <= current bid is added to red pricemarker ("Sells" plot) which is common sense but it is also added to green pricemarker ("Buys" plot) as well as volume traded at a price >= current ask which get me confused since I would wait for the "Buys" plot to tally only volume traded at a price >= current ask.
    Did I miss something ?

    Gérard

    #2
    Very observant. This is correct. The purpose of this indicator is NOT to display absolute values but to display a histogram relationship. In order to get the desired visual display, I had to create one bar (buys) that has the total buys and sells. Then I put the sells bars in front of it which only has the sells volume and hides the sells portion of the buys bar so what you see is a green one bar split with green and red color.
    RayNinjaTrader Customer Service

    Comment


      #3
      Another Possibility

      Hello
      A question to the cracks . May it be possible to code something like this?
      It's just showing the number of contracts traded at the bid versus number of contracts traded at the ask , so called marketdelta. It's from tradestation.
      regs
      Jojo
      Attached Files

      Comment


        #4
        Technically this is possible but it is far outside of the scope of what is officially supported.

        Perphaps this product may do the trick or, the developer of this product is capable of custom coding this indicator for a fee.

        RayNinjaTrader Customer Service

        Comment


          #5
          I modified the BuySellVolume indicator so as to watch one red pricemarker and one green pricemarker displaying red trade volume and green trade volume from the Time & Sales window. The code is :

          if (firstPaint)
          firstPaint = false;
          else
          {
          double tradeVol = previousVol == 0 ? Volume[0] : Volume[0] - previousVol;
          if (Close[0] >= GetCurrentAsk())
          {
          buys += tradeVol;
          positive.Set(tradeVol);
          negative.Set(0);
          }
          else if (Close[0] <= GetCurrentBid())
          {
          sells += tradeVol;
          negative.Set(tradeVol);
          positive.Set(0);
          }
          }

          previousVol = Volume[0];
          if (!firstPaint && !Historical)
          {
          Values[0].Set(negative[0]);
          Values[1].Set(positive[0]);
          }

          It went Ok then I wanted to get those trade volume displayed for a limited number of ticks; so I modified the two above lines this way :

          if(CurrentBar < period)
          return;
          Values[0].Set(SUM(negative, period)[0]);
          Values[1].Set(SUM(positive, period)[0]);

          The result is very disappointing : using Market Replay, as the T&S window shows green volume = 1 and red volume = 250, the green pricemarker is 345K and the red pricemarker is 1 !

          I welcome any help.
          Gérard

          Comment


            #6
            Ninjatrader Ray,

            Could you please post that volume indicator. I would really like to have something like that.

            Thanks,

            Geoff

            Comment


              #7
              Unfortunately I do not have an indicator to post
              RayNinjaTrader Customer Service

              Comment


                #8
                I was just wondering if its possible to save this data for the next time i open the program?
                Also is it possible to set the larger bar on top, instead of the green all the time? it would make it a whole lot easier to see which side produced the higher volume.

                Comment


                  #9
                  Unfortunately not on both items.
                  RayNinjaTrader Customer Service

                  Comment


                    #10
                    since the green column is buys+sells, not buys like I had first thought, could someone explain how to read (interpret) this indicator properly? thanks.

                    Comment


                      #11
                      Green column represents buys but is consctructed of buy + sells since once the red bar is show, it sits in front of the green bar. Thus, what is left visually on the green bar is the buys. Its a visual trick. The values in the databox really serve no purpose and would give you the total value of buys + sells.
                      RayNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by maybeimnotrader, Today, 05:46 PM
                      0 responses
                      6 views
                      0 likes
                      Last Post maybeimnotrader  
                      Started by quantismo, Today, 05:13 PM
                      0 responses
                      6 views
                      0 likes
                      Last Post quantismo  
                      Started by AttiM, 02-14-2024, 05:20 PM
                      8 responses
                      166 views
                      0 likes
                      Last Post jeronymite  
                      Started by cre8able, Today, 04:22 PM
                      0 responses
                      8 views
                      0 likes
                      Last Post cre8able  
                      Started by RichStudent, Today, 04:21 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post RichStudent  
                      Working...
                      X