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

Accessing Buy/Sell Volume Per Price Level in a Candle

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

    Accessing Buy/Sell Volume Per Price Level in a Candle

    I am using an order flow tool that shows buy/sell volume per price level for each candle. I like to use Renko Bars so Volumetric candles do not work for me. I would like to write a strategy that can see each price level's buy/sell volume so I can work off of imbalances. I am not sure what data set this in Ninjatrader so I don't exactly know what I am asking for. The picture below is what I am seeking to identify. Can you point me in the right direction regarding how to access this data?

    #2
    Hello cpabiz20k,

    Thank you for your note.

    As you are using a third party order flow indicator, we would not really be able to assist with using that in a strategy as we did not develop the indicator and have no way of knowing what information that indicator may expose for use in other scripts. I would recommend reaching out to the vendor you received the order flow tool from to see what if any information it exposes for use in another script such as a strategy as they would be best equipped to advise on that.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      I might have been too specific - I was really just looking for the way to access the data and I wanted to show the data I was looking for. Is there any way to get that data?

      Comment


        #4
        Hello cpabiz20k,

        Thank you for your reply.

        You could take a look at the built in BuySellVolume indicator that illustrates how to get the buy and sell volume from OnMarketData - you would have to create logic to keep track of the volumes at each price per bar. That may get tricky given how renko bars redraw, but you could certainly take a look at the attached script too, which would be similar but uses a 1 tick data series and may work a little better for you since it wouldn't need Tick Replay for historical calculation.

        Please let us know if we may be of further assistance to you.

        Attached Files
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hello cpabiz20k,

          You can add another timeframe in ticks with a value of 100. Use 2nd timeframe to get the volume of the instrument/symbol per price. Also, you must have a data for ticks for the specific instrument. Here's an example:

          Code:
          protected override void OnStateChange()
          {
          if (State == State.SetDefaults)
          {
          Description = @"Enter the description for your new custom Strategy here.";
          Name = "AccessingBuySellVolume";
          Calculate = Calculate.OnBarClose;
          EntriesPerDirection = 1;
          EntryHandling = EntryHandling.AllEntries;
          IsExitOnSessionCloseStrategy = true;
          ExitOnSessionCloseSeconds = 30;
          IsFillLimitOnTouch = false;
          MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
          OrderFillResolution = OrderFillResolution.Standard;
          Slippage = 0;
          StartBehavior = StartBehavior.WaitUntilFlat;
          TimeInForce = TimeInForce.Gtc;
          TraceOrders = false;
          RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
          StopTargetHandling = StopTargetHandling.PerEntryExecution;
          BarsRequiredToTrade = 20;
          // Disable this property for performance gains in Strategy Analyzer optimizations
          // See the Help Guide for additional information
          IsInstantiatedOnEachOptimizationIteration = true;
          }
          else if (State == State.Configure)
          {
          AddDataSeries("CL 09-22", BarsPeriodType.Tick, 100);
          }
          }
          
          protected override void OnBarUpdate()
          {
          Print("BarsInProgress: " + BarsInProgress);
          //Add your custom strategy logic here.
          
          // BarsInprogress == 0 is for 1st or main timeframe
          // BarsInProgress == 1 is for 2nd timeframe
          if (BarsInProgress == 1)
          {
          Print(Time[0]);
          Print("Bar Volume: " + Bars.GetVolume(CurrentBar));
          Print("");
          }
          }
          I hope this code helps you out.

          I build useful software systems for financial markets
          Generate automated strategies in NinjaTrader : www.stratgen.io

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NRITV, Today, 01:15 PM
          2 responses
          6 views
          0 likes
          Last Post NRITV
          by NRITV
           
          Started by frankthearm, Today, 09:08 AM
          7 responses
          31 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by maybeimnotrader, Yesterday, 05:46 PM
          5 responses
          25 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by quantismo, Yesterday, 05:13 PM
          2 responses
          19 views
          0 likes
          Last Post quantismo  
          Started by adeelshahzad, Today, 03:54 AM
          5 responses
          33 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X