• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Wish to display volume on chart

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

    Wish to display volume on chart

    Hello, I created an indicator that splits out the ask and bid volume. Works nice with one exception. If I stop the indicator and restart it for any reason, it resets the data to zero and starts displaying from the restart rather than displaying the data from the beginning of the range of data.
    Please help me understand what I am missing.
    Morris

    #2
    Hi morrnel, thanks for your question.

    It's happening because the method you are using to access the historical bid/ask volume is reliant on real time data. Please read this page on using Tick Replay to access historical bid/ask data. The buy/sell volume indicator also demonstrates how to do this. e.g.

    Code:
    protected override void OnMarketData(MarketDataEventArgs e)
            {
                if(e.MarketDataType == MarketDataType.Last)
                {
                    if(e.Price >= e.Ask)
                        buys += (Instrument.MasterInstrument.InstrumentType == Cbi.InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume(e.Volume) : e.Volume);
                    else if (e.Price <= e.Bid)
                        sells += (Instrument.MasterInstrument.InstrumentType == Cbi.InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume(e.Volume) : e.Volume);
                }
            }
    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the info. Please help me understand, as I watch the VOL indicator, the bar changes in height on each tick. How and why is that different?

      Comment


        #4
        Hi morrnel, thanks for your reply.

        The VOL indicator is accumulating the volume data. What are you seeing that is different?

        I look forward to hearing from you.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Each time a tick is processed, the bar is updated until the bar completes

          Comment


            #6
            Hi morrnel, thanks for your reply.

            Please forgive me but I am not sure of the question being asked. Could you explain further?
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              When I watch each bar, it changes each time a tick is processed. The tick counter changes. The volume bar goes up a bit. So how do I get my indicator to work in the very same way?

              Comment


                #8
                Hi morrnel, thanks for your reply.

                First the script must run OnEachTick or OnPriceChange. If it is, when you update Values[0][0] with some number, the plot will be changed to that value as well. Theres nothing else that would need to be added to make this happen.

                Chris L.NinjaTrader Customer Service

                Comment


                  #9
                  Ok, thanks!

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by random9570, Yesterday, 09:01 PM
                  1 response
                  13 views
                  0 likes
                  Last Post Fulcanelli  
                  Started by natngk, Yesterday, 08:28 PM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_Marco  
                  Started by Borsz, 05-27-2020, 10:37 AM
                  2 responses
                  23 views
                  0 likes
                  Last Post aligator  
                  Started by Tagliareni, Yesterday, 08:10 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post Tagliareni  
                  Started by alanbb8989, Yesterday, 06:10 PM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_EricB  
                  Working...
                  X