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

knowing what kind of sale volume it is

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

    knowing what kind of sale volume it is

    I was wondering how one can tell if it is a buy or a sale in volume I looked at your volume profile and i am trying to figure if there is a way to parse bid volume and ask volume

    if (e.MarketDataType == MarketDataType.Ask)
    {
    askPrice = e.Price;
    return;
    }

    if (e.MarketDataType == MarketDataType.Bid)
    {
    bidPrice = e.Price;
    return;
    }

    if (e.MarketDataType != MarketDataType.Last || ChartControl == null || askPrice == 0 || bidPrice == 0)
    return;

    if (Bars != null && !SessionIterator.IsInSession(Core.Globals.Now, true, true))
    return;

    price = e.Price;
    volume = e.Volume;

    if (!cacheDictionary.ContainsKey(price))
    cacheDictionary.Add(price, new VolumeInfoItem());

    volumeInfoItem = cacheDictionary[price];

    if (price >= askPrice)
    volumeInfoItem.up += volume;
    else if (price <= bidPrice)
    volumeInfoItem.down += volume;
    else
    volumeInfoItem.neutral += volume;
    }

    #2
    Hello ballboy11,
    Thanks for your post.

    In OnMarketData() you can use something like the following to print the bid/ask price followed by the appropriate bid/ask volume. All you would need to do is check for the right MarketDataType and then check its volume.
    Code:
    protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
    {
        if (marketDataUpdate.MarketDataType == MarketDataType.Ask)
            Print("Ask = " + marketDataUpdate.Price + " " + marketDataUpdate.Volume);
        else if (marketDataUpdate.MarketDataType == MarketDataType.Bid)
            Print("Bid = " + marketDataUpdate.Price + " " + marketDataUpdate.Volume);
    }
    Help Guide - OnMarketData()

    Please let me know if you have any questions.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      when using this scenario that is not the Actual contracts sold or bought it is just an ask and bid price and how many for sale or is it or is there a way when the volume actually been sold to find out if it was a bid or ask?


      protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
      {
      if (marketDataUpdate.MarketDataType == MarketDataType.Ask)
      Print("Ask = " + marketDataUpdate.Price + " " + marketDataUpdate.Volume);
      else if (marketDataUpdate.MarketDataType == MarketDataType.Bid)
      Print("Bid = " + marketDataUpdate.Price + " " + marketDataUpdate.Volume);
      }

      Comment


        #4
        Are you talking about looking back at historical data to see the ask/bid volume, or are you talking about live data?
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          No, I collected the volume and I want to know which volume that has been bought or sold is greater. Live data

          Comment


            #6
            NT8 Volume Profile

            When will users be able to refresh charts and have volume profile histogram be resident and refreshed. Additionally it would be fabulous to be able to configure composite profiles for longer time frames. jus asking for a friend...he's too crabby to pose this himself.
            Thanks a Billion,
            PD

            Comment


              #7
              ballboy11,
              Ok, just checking. You're going to want to use either OnMarketData() like I demonstrated, or OnMarketDepth(). Depending on how exactly you want to look for that information.
              I am not aware of a way to request this data in reverse order. That is, check for volume first and then try and decide what kind it was. You need to check first for whether it is ask or bid and then see the volume information that way.

              Help Guide - OnMarketDepth()

              When will users be able to refresh charts and have volume profile histogram be resident and refreshed. Additionally it would be fabulous to be able to configure composite profiles for longer time frames. just asking for a friend...he's too crabby to pose this himself.
              PeterDavid,
              The VolumeProfile indicator, when used with Tick Replay data, will provide a per session volume profile. Without tick replay, the volume profile is built from when you open the chart.

              To enable tick replay in NinjaTrader8: https://ninjatrader.com/support/help...marketdata.htm
              Once enabled you can then optionally enable it per data series in the data series window of the chart.

              Once you have tested with Tick replay let me know if that is not what you are looking for.
              Josh G.NinjaTrader Customer Service

              Comment


                #8
                Composite Volume Profile

                Ok I enabled tick replay and received the current days Vol Pro. How would I configure the indicator or the data series to do a composite profile of the last 5 days, or 10 days or month?

                Comment


                  #9
                  Based on my brief knowledge of composite volume profiles they are just a combination of multiple sessions. So you would just need tick replay enabled and then set your data series to that amount of days. Since bars are built with tick data you would only be able to build bars back as far as your historical data provider allows download of tick data.

                  EDIT: To further this, the setting you are looking for inside your Data Series' settings is "Days to Load" (if you are loading data based on "Days")
                  Last edited by NinjaTrader_JoshG; 05-15-2018, 08:47 AM.
                  Josh G.NinjaTrader Customer Service

                  Comment


                    #10
                    NT8 Volume Profile

                    In the data series dialogue box I can configure "days to load" and enter any amount; however on the volume profile properties window I can not seem to enter any value I want, but input is fixed at 256 or "infinite." I cant seem to get a composite of previous days, no matter how I configure data series or indicator properties.

                    Comment


                      #11
                      i think where I am getting confused a bit is the code below. This is the actual code from volume profile and the confusion is the ask and bid types are returned without finishing the loop. if it is a sold contract, a price and volume is set. I already made my indicator that I want and it works great but all i wanted to know if it was the buyers volume or the sellers volume.



                      if (e.MarketDataType == MarketDataType.Ask)
                      {
                      askPrice = e.Price;
                      return;
                      }

                      if (e.MarketDataType == MarketDataType.Bid)
                      {
                      bidPrice = e.Price;
                      return;
                      }

                      if (e.MarketDataType != MarketDataType.Last || ChartControl == null || askPrice == 0 || bidPrice == 0)
                      return;
                      // HOW CAN BID OR ASK PRICE EVER BE ZERO IF BID AND ASK PRICE IS RETURNED?

                      // IGNORE if (Bars != null && !SessionIterator.IsInSession(Core.Globals.Now, true, true))
                      return;

                      price = e.Price;
                      volume = e.Volume;

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Barry Milan, Yesterday, 10:35 PM
                      5 responses
                      16 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by DanielSanMartin, Yesterday, 02:37 PM
                      2 responses
                      13 views
                      0 likes
                      Last Post DanielSanMartin  
                      Started by DJ888, 04-16-2024, 06:09 PM
                      4 responses
                      13 views
                      0 likes
                      Last Post DJ888
                      by DJ888
                       
                      Started by terofs, Today, 04:18 PM
                      0 responses
                      12 views
                      0 likes
                      Last Post terofs
                      by terofs
                       
                      Started by nandhumca, Today, 03:41 PM
                      0 responses
                      8 views
                      0 likes
                      Last Post nandhumca  
                      Working...
                      X