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

Daily chart VOL[0] not equal to Market Analyzer Daily volume

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

    Daily chart VOL[0] not equal to Market Analyzer Daily volume

    Vol[0] on daily chart is different then Daily Volume in Market Analyzer.

    #2
    monpere,

    This has to do with "non-last qualifying" trades. These are not reported by all data providers on a tick-by-tick basis, and are only reported as historical data.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_AdamP View Post
      monpere,

      This has to do with "non-last qualifying" trades. These are not reported by all data providers on a tick-by-tick basis, and are only reported as historical data.
      I don't understand your answer. The numbers are generally orders of magnitudes different. Market analyzer might be reporting 1,000 volume, and VOL[0] is reporting 25,000. Are you saying, for example, looking at a daily chart, at 1pm EST VOL[0] is not defined because today's session is not yet historical, so I can only access VOL[1] ? But, VOL[0] always return a value, what value is it reporting?

      Comment


        #4
        monpere,

        Likely I'll need to see an example to really see what is going on here, however note my prior explanation as to why there may be some difference. Do you have code or output you can display here in this thread?
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_AdamP View Post
          monpere,

          Likely I'll need to see an example to really see what is going on here, however note my prior explanation as to why there may be some difference. Do you have code or output you can display here in this thread?
          Here is a simple indicator, output, and Market Analyzer screens, applied to a daily chart and all using the same session template.

          ------ Code -----
          protected override void Initialize() {
          CalculateOnBarClose = false;
          }

          protected override void OnBarUpdate() {
          Print("Bar " +CurrentBar +" " +Time[0].ToString("ddMMMyy") +" Volume " +VOL(BarsArray[0])[0]);
          }
          Attached Files
          Last edited by monpere; 10-01-2012, 06:03 AM.

          Comment


            #6
            Originally posted by NinjaTrader_AdamP View Post
            monpere,

            Likely I'll need to see an example to really see what is going on here, however note my prior explanation as to why there may be some difference. Do you have code or output you can display here in this thread?
            ------ Code -------
            protected override void Initialize() {
            CalculateOnBarClose = false;
            Add("CL 11-12",PeriodType.Day, 1);
            Add("CL 12-12",PeriodType.Day, 1);
            Add("CL 01-13",PeriodType.Day, 1);
            }

            protected override void OnBarUpdate() {
            Print(Instrument.FullName +" " +Time[0].ToString("ddMMMyy") +" Volume " +VOL()[0]);
            }
            Attached Files
            Last edited by monpere; 10-01-2012, 06:27 AM.

            Comment


              #7
              monpere, thanks for the scripts - which data provider are you working with here? One value you access would be native to the bars themselves (VOL) while the .DailyVolume would be taken directly from the market providers Level 1 data stream provided - you could access this value as well in OnMarketData() in your code.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Bertrand View Post
                monpere, thanks for the scripts - which data provider are you working with here? One value you access would be native to the bars themselves (VOL) while the .DailyVolume would be taken directly from the market providers Level 1 data stream provided - you could access this value as well in OnMarketData() in your code.
                I use Interactive Brokers, and Mirus. I would like to get the volume displayed in the DailyVolume field of Market Analyzer. Are you saying I can get that value from OnMarketData()? If so, can you please provide the line of code that would do that inside OnMarketData()

                Thanks

                Comment


                  #9
                  Correct, this would be available in OnMarketData() and is what the Market Analyzer would access - it will be called / updated on each change in DailyVolume:

                  protected override void OnMarketData(MarketDataEventArgs e)
                  {
                  if (e.MarketDataType == MarketDataType.DailyVolume)
                  Print("DailyVol = " + e.Volume);
                  }
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Bertrand View Post
                    Correct, this would be available in OnMarketData() and is what the Market Analyzer would access - it will be called / updated on each change in DailyVolume:

                    protected override void OnMarketData(MarketDataEventArgs e)
                    {
                    if (e.MarketDataType == MarketDataType.DailyVolume)
                    Print("DailyVol = " + e.Volume);
                    }
                    Thanks. Does OnMarketData() gets called once for each BarsInProgress, or does it only apply to BarsInProgress 0?

                    Comment


                      #11
                      It will be called for all unique instruments in your strategy, which you can filter via BarsInProgress.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_Bertrand View Post
                        Correct, this would be available in OnMarketData() and is what the Market Analyzer would access - it will be called / updated on each change in DailyVolume:

                        protected override void OnMarketData(MarketDataEventArgs e)
                        {
                        if (e.MarketDataType == MarketDataType.DailyVolume)
                        Print("DailyVol = " + e.Volume);
                        }
                        Is this DailyVolume data available anywhere before OnMarketData is called the first time? For low liquidity or inactive contracts, it may take a while before getting the first call to OnMarketData.

                        Comment


                          #13
                          Unfortunately that this only be available in OnMarketData(). An alternative could be running a custom count in your OnBarUpdate() for this figure based on the applied session template hours.
                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by NinjaTrader_Bertrand View Post
                            Unfortunately that this only be available in OnMarketData(). An alternative could be running a custom count in your OnBarUpdate() for this figure based on the applied session template hours.
                            MarketAnalyzer has a DailyVoume value before the first OnMarketData() call. Where does it get that value? How can I get access to that value?

                            Comment


                              #15
                              I'm not following you monpere, there needs to be a Level 1 data event for it to return any value, which events did you listen to in your script then?
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by algospoke, Yesterday, 06:40 PM
                              2 responses
                              19 views
                              0 likes
                              Last Post algospoke  
                              Started by ghoul, Today, 06:02 PM
                              3 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              45 views
                              0 likes
                              Last Post jeronymite  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              7 responses
                              20 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              10 responses
                              181 views
                              0 likes
                              Last Post jeronymite  
                              Working...
                              X