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

Historical Ask Bid volume footprint

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

    Historical Ask Bid volume footprint

    Hello,

    I am trying to calculate historical ask/bid volume per bar. I can not find the right answer in ninjascript documentation, so I decided to post new thread.

    Primary chart 100 ticks
    my script:

    protected override void Initialize()
    {
    Add(Instrument.FullName, PeriodType.Tick, 1, MarketDataType.Ask);
    Add(Instrument.FullName, PeriodType.Tick, 1, MarketDataType.Bid);
    Add(Instrument.FullName, PeriodType.Tick, 1, MarketDataType.Last);

    ClearOutputWindow();
    CalculateOnBarClose = false;
    DisplayInDataBox = false;
    }

    protected override void OnBarUpdate()
    {

    // primary data series - chart
    if(BarsInProgress == 0)
    {
    Print("-------");
    Print("Chart volume: " + Volume[0]);
    Print("Total volume: " + this.totalVolume);
    Print("Total ask: " + this.askVolume);
    Print("Total bid: " + this.bidVolume);

    this.askVolume = 0;
    this.bidVolume = 0;
    this.totalVolume = 0;
    }

    // new data series
    if(BarsInProgress == 1) this.askVolume += (int)Volumes[1][0];
    if(BarsInProgress == 2) this.bidVolume += (int)Volumes[2][0];
    if(BarsInProgress == 3) this.totalVolume += (int)Volumes[3][0];
    }

    Output:

    -------
    Chart volume: 225
    Total volume: 231
    Total ask: 1897
    Total bid: 3479
    -------
    Chart volume: 210
    Total volume: 189
    Total ask: 1629
    Total bid: 2818
    -------
    Chart volume: 196
    Total volume: 207
    Total ask: 2104
    Total bid: 2263


    As you see in output,
    "Chart volume" is correct value which is displayed on chart
    "Total volume" is close to primary volume, but not exact the same, but bid and ask volume is totally different values.

    Could anybody help me with this, please?

    #2
    Hello tomekas,

    Thanks for your post and welcome to the forums!

    What datafeed are you using and what instrument have you developed your data on?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks for reply,

      I am using kinetick for historical tick data and continuum for real time data.
      I am trying to calculate bid/ask volume for GBP futures in this case 6b 09-16.

      I am already using footprint chart indicator so I can confirm that historical data is loaded, I can see bid/ask volumes on every price levels, but when I calculate volume by myself it does not match original volume indicator values.

      I look forward to hearing from you,
      Tomas

      Comment


        #4
        Hello

        Thanks for your reply.

        Ask/Bid series are not executions, they are updates sent out by the exchange. Please refer to this thread for further information: http://ninjatrader.com/support/forum...886#post423886

        From the helpguide: The historical bid/ask series holds all bid/ask events sent out by the exchange. This would not be equivalent to the bid/ask at a specific time a trade went off.

        HelpGuide reference: http://ninjatrader.com/support/helpG..._ask_serie.htm
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thanks for information, Paul.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by hazylizard, Today, 08:38 AM
          0 responses
          4 views
          0 likes
          Last Post hazylizard  
          Started by Max238, Today, 01:28 AM
          5 responses
          42 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by giulyko00, Yesterday, 12:03 PM
          3 responses
          12 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by habeebft, Today, 07:27 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_ChristopherS  
          Started by AveryFlynn, Today, 04:57 AM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_Erick  
          Working...
          X