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 Volume indicator

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

    Daily Volume indicator

    Hello, I would like to ask for help if there is, or how to construct daily volume indicator. There is a daily volume in Market analyzer, but is there any chance to plot it as an indicator in chart? Thank you for your help or any advice.

    #2
    Hello Tomass, thanks for your question.

    The OnMarketData method can be overridden for the daily volume. e.g.

    Code:
    double DailyVol;
    protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
    {
    
        if (marketDataUpdate.MarketDataType == MarketDataType.DailyVolume)
            DailyVol = marketDataUpdate.Volume;
    }
    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thank you very much. I am used to NT7 and kinda starting with NT8, can you please advice me any example of indicator using marketDataUpdate.Volume, or any other indicator that I can try to reverse engineer it? Basically I am trying to achive Volume indicator (similar to VolumeUpDown), but instead of volume on each tick it will be compounding volume of day, like in DailyVolume in market Analyzer. Hope it makes sence and will be glad for any advice to make this work. Thank you for your patience and time.

      Comment


        #4
        Hi Tomass, thanks for your reply.

        It could be done like the example attached. Note the DailyVolume will only be available in real time data. To get this information in historical mode one would need to manually accumulate the volume data from the beginning of each session with the MarketDataType.Last data type. See this page for more details on tick replay.

        Kind regards.
        Attached Files
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Hi Chris,

          I do need the DailyVolume for historical data in one of my indicators. You have attached a link, which indicates that the Tick Replay must be used. I have an indicator that only Calculates OnClose and for performance reason i avoid Tick Replay. Is there a way to get the DailyVolume for historical data without Tick Replay?

          Thx.

          Comment


            #6
            Hi Stefan, unfortunately, to get this exact MarketDataType.DailyVolume value from OnMarketData historically you do need to use tick replay to get this piece of information. The alternative is to use AddDataSeries() to add a daily series, then take the Volume information from that series.

            if(BarsInProgress == 1)
            {
            Print(Volumes[1][0] + " " + Times[1][0]);
            }
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChrisL View Post
              Hi Tomass, thanks for your reply.

              It could be done like the example attached. Note the DailyVolume will only be available in real time data. To get this information in historical mode one would need to manually accumulate the volume data from the beginning of each session with the MarketDataType.Last data type. See this page for more details on tick replay.

              Kind regards.
              Hi Chris,

              This script is awesome. How could it be transformed to calculate the daily average traffic for the past x days, and then, using this script, compute a percentage value from the quotient of the two in terms of what percentage of the average has already been achieved in this session? And to display this in the same way on a plot line chart?

              Thank you,
              David

              Comment


                #8
                Hello David,

                You can use a loop to accumulate the Volume of bars to a variable.

                private double accumulatedVolume;

                for (int index = 0; index < 10; index++)
                {
                accumulatedVolume += Volume[index];
                }

                If you want to divide the current bars Volume[0] with the accumulatedVolume this would appear as:
                Volume[0] / accumulatedVolume

                Below is a link to a support article on adding plots and setting the value.


                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by funk10101, Today, 09:43 PM
                0 responses
                6 views
                0 likes
                Last Post funk10101  
                Started by pkefal, 04-11-2024, 07:39 AM
                11 responses
                37 views
                0 likes
                Last Post jeronymite  
                Started by bill2023, Yesterday, 08:51 AM
                8 responses
                44 views
                0 likes
                Last Post bill2023  
                Started by yertle, Today, 08:38 AM
                6 responses
                26 views
                0 likes
                Last Post ryjoga
                by ryjoga
                 
                Started by algospoke, Yesterday, 06:40 PM
                2 responses
                24 views
                0 likes
                Last Post algospoke  
                Working...
                X