Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BuySellVolume returni

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

    BuySellVolume returni

    How could I inhibit the return to zero on the first tick of each bar so that the actual tally of alSells and alBuys are displayed all the way ? I tried to have that part of code as a comment but sometimes one of the two variables become < 0.

    protected override void OnBarUpdate()
    {
    if (CurrentBar < activeBar)
    {
    Values[0].Set((double)alSells[CurrentBar]);
    Values[1].Set((double)alBuys[CurrentBar]);
    return;
    }
    else if (CurrentBar != activeBar)
    {
    //
    /* previousVol = 0;
    alBuys.Insert(Math.Max(activeBar, 0), Historical ? 0 : buys);
    alSells.Insert(Math.Max(activeBar, 0), Historical ? 0 : sells);
    buys = 0;
    sells = 0;
    activeBar = CurrentBar; */
    }
    Last edited by grd974; 10-10-2007, 11:41 AM.

    #2
    Could you clarify the intent of your post?
    RayNinjaTrader Customer Service

    Comment


      #3
      Sure.

      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 by now :

      <<<
      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]);
      }
      >>>

      The fact that each pricemarker is cleared at the beginning of avery new bar bothers me : I want buys and sells to keep on suming up every relevant incoming tradevol and I don't want to change my chart from a x minutes bar to a y ticks bar.
      I if could prevent buys and sells from being cleared, my rationale would be the following :
      initialize Bsubtractbase = 0 and Ssubtractbase = 0
      on bar update do
      {
      buys = buys + tradeVol - Bsubtractbase
      tickcount = tickcount +1
      if remainder of (tickcount/myparam) = 0 then Bsubtractbase= buys
      sells= sells + tradeVol - Ssubtractbase
      tickcount = tickcount +1
      if remainder of (tickcount/myparam) = 0 then Ssubtractbase= sells
      }

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Kirk Thorns, Today, 05:34 PM
      0 responses
      4 views
      0 likes
      Last Post Kirk Thorns  
      Started by JobDjassem, Today, 05:24 PM
      0 responses
      7 views
      0 likes
      Last Post JobDjassem  
      Started by Kirk Thorns, Today, 05:06 PM
      0 responses
      9 views
      0 likes
      Last Post Kirk Thorns  
      Started by CyberNate, Today, 03:11 PM
      5 responses
      25 views
      0 likes
      Last Post CyberNate  
      Started by NinjaTrader_ChrisL, Today, 03:44 PM
      0 responses
      6 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Working...
      X