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

SuperDom Column of the Last X Minutes

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

    SuperDom Column of the Last X Minutes

    Hi,


    I`m working on some changes of a Super DOM Column that I got from internet.
    This Super DOM Column plots the Buy and Sell Volume from the midpoint of the Column out to the left (Buy Volume) and to the right (Sell Volume) versus the Volume Super DOM Column which plots from left to right. Update 07/01/2019 – Added Percent display option.


    The script has the following lines:
    long buyVolume = 0;
    long sellVolume = 0;

    bool gotBuy = Sells.TryGetValue(row.Price, out sellVolume);
    bool gotSell = Buys.TryGetValue(row.Price, out buyVolume);


    I would like to get the sellVolume/buyVolume of the last 10 minutes.
    Not a volume of each 10 minutes, but of the last 10 minutes.

    I read this tread below:
    Hi, I'd like to try to get volume of the same bar of yesterday's session using this piece of code: TimeSpan oneday = new TimeSpan(24, 00, 00); Print("\n" + Time[0].ToString()); int barsAgo1 = Bars.GetBar(Time[0].Subtract(oneday)); Print(Time[barsAgo1].ToString() +" " + Volume[barsAgo1].ToString());


    But I didn`t figureout how to use a similar method with "Sells.TryGetValue(row.Price"

    It there a way to do it?
    I had tried something like this to get the total volume of 10 minutes ago and make the difference, but I does not compitel

    DateTime filterTime = DateTime.Now.AddMinutes(-10);
    bool gotBuyFilter = Sells.TryGetValue(row.Price(Time[0].Subtract(filterTime)),out buyVolumeFilter);
    Thanks!

    #2
    Hello cassiano_sanches, thanks for your question.

    This could be done by replicating the BarTimer indicator, which sets up an asynchronous timer where you can keep track of time. Unfortunately, the support team can not make custom code so a community member would need to help with implementation if it's needed.

    Edit: I noticed the BarTimer uses the ChartControl dispatcher. I am going to set up a Superdom column that sets up the timer on SuperDom.Dispatcher.InvokeAsync

    Please let me know if I can assist any further.
    Last edited by NinjaTrader_ChrisL; 05-07-2020, 03:54 PM.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi cassiano_sanches,

      I attached an example here that implements the timer in a SuperDOM column. If you would like to test this, place the attached file within Documents\NinjaTrader 8\bin\Custom\SuperDomColumns and compile.

      Please let me know if I can assist any further.
      Attached Files
      Last edited by NinjaTrader_ChrisL; 05-07-2020, 04:05 PM.
      Chris L.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_ChrisL View Post
        Hi cassiano_sanches,

        I attached an example here that implements the timer in a SuperDOM column. If you would like to test this, place the attached file within Documents\NinjaTrader 8\bin\Custom\SuperDomColumns and compile.

        Please let me know if I can assist any further.
        The code you sent prints the time stamp of each tick.
        But, how can I get this time stamp, do the AddMinutes(-x) and set the SessionBegin datetime?
        I would like do define the "section start and end datetime" on each OnStateChange.

        Thanks for your support!

        Comment


          #5
          Hi cassiano_sanches, thanks for your reply.

          Since you have a timer going since State.Active is reached, the script can know when 10 minutes has passed since the script was started. To get session information a SessionIterator could be used. The Volume column implements this. I would start there as an exemplar.

          Please let me know if I can assist any further.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_ChrisL View Post
            Hi cassiano_sanches, thanks for your reply.

            Since you have a timer going since State.Active is reached, the script can know when 10 minutes has passed since the script was started. To get session information a SessionIterator could be used. The Volume column implements this. I would start there as an exemplar.

            Please let me know if I can assist any further.
            Hi Chris L,

            I don`t want to start a new exemplar every 10 minutes.
            I want the last 10 minutes data (volume) every second or tick.
            If its 10:10, the volume should be from 10:00 until 10:10.
            If its 10:11, the volume shoud be from 10:01 until 10:11.and so on..

            Comment


              #7
              Hello cassiano_sanches,

              This is Jim, responding on behalf of Chris who is out of the office at this time.

              Data series cannot be added in SuperDOM columns like they can indicators and strategies. For indicators and strategies, we could use AddDataSeries to add a tick or minute based data series. We would then use OnBarUpdate to processes that data. In a SuperDOMColumn, you can use a BarsRequest to request a data series. You can then subscribe to updates to the BarsRequest's Update event which will behave similarly to OnBarUpdate.

              You could then, for example, request a single minute data series and then after every 10 bars in the BarsRequest's Update event, subtract the volume from 10 bars ago.

              The Volume SuperDOM Column provides an example for implementing a BarsRequest.

              Documentation on BarsRequests can be found here - https://ninjatrader.com/support/help...arsrequest.htm

              We look forward to assisting.
              JimNinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Jim View Post
                Hello cassiano_sanches,

                This is Jim, responding on behalf of Chris who is out of the office at this time.

                Data series cannot be added in SuperDOM columns like they can indicators and strategies. For indicators and strategies, we could use AddDataSeries to add a tick or minute based data series. We would then use OnBarUpdate to processes that data. In a SuperDOMColumn, you can use a BarsRequest to request a data series. You can then subscribe to updates to the BarsRequest's Update event which will behave similarly to OnBarUpdate.

                You could then, for example, request a single minute data series and then after every 10 bars in the BarsRequest's Update event, subtract the volume from 10 bars ago.

                The Volume SuperDOM Column provides an example for implementing a BarsRequest.

                Documentation on BarsRequests can be found here - https://ninjatrader.com/support/help...arsrequest.htm

                We look forward to assisting.
                Thanks Jim.
                I`ll work on that.

                Best Regards,

                Cassiano Sanches

                Comment


                  #9
                  Hi, any further development? I'm struggling to put such functionality. Did you come with any solution ?

                  Comment


                    #10
                    Hello guicrodrigues,

                    Welcome to the NinjaTrader forums!

                    Below I am providing links to examples that use a BarsRequest to request data that you may find helpful.



                    As well as a link to an example superdomcolumn.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Chelsea, thanks for your support, but I'm a very beginner programmer. I think that what I'm asking is quite simple.

                      I have a feeling that I must change something between line 330 and 455. Am I right?

                      Is it possible for you guys to implement this natively?

                      Attached Files

                      Comment


                        #12
                        Hello guicrodrigues,

                        To change the BarsRequest to a 1 minute bar, the BarsPeriodType would be assigned the value of BarsPeriodType.Minute, and the Value would be assigned a value of 1.

                        The volume of the current bar index would be added to a variable tracking the volume and the volume of the bar index 10 bars ago would be subtracted from the variable. This would be in the BarsRequest.Update event handler method on lines 43 to 104.


                        I am happy to submit a feature request for our development to consider adding a Volume-of-last-10-minutes SuperDOM Column.

                        Once I have a tracking ID# for this request I will post in this thread for future reference.

                        Please note, we receive many requests and cannot reasonably implement all requested features or changes. Interest is tracked internally and if enough interest is tracked, it would be weighed against how feasible it would be to make those changes to consider implementing, so we cannot offer an ETA or promise of fulfillment.

                        When new features are implemented, they will be listed in the Release Notes page of the Help Guide. The ID number may be different than the internal feature request tracking ID, but the description of the feature will let you know if that feature has been implemented.

                        Release Notes - https://ninjatrader.com/support/help...ease_notes.htm


                        You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our NinjaTrader Ecosystem team follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Chelsea, please open this request. Could be something that we can alter from last 1 minute to N minutes? I will try to implement what you wrote.
                          Thanks very much!

                          Comment


                            #14
                            Hello guicrodrigues,

                            This request is being tracked with ID# SFT-5710.

                            Please note, we receive many requests and cannot reasonably implement all requested features or changes. Interest is tracked internally and if enough interest is tracked, it would be weighed against how feasible it would be to make those changes to consider implementing, so we cannot offer an ETA or promise of fulfillment.​
                            Chelsea B.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by cls71, Today, 04:45 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post cls71
                            by cls71
                             
                            Started by mjairg, 07-20-2023, 11:57 PM
                            3 responses
                            213 views
                            1 like
                            Last Post PaulMohn  
                            Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                            4 responses
                            544 views
                            0 likes
                            Last Post PaulMohn  
                            Started by GLFX005, Today, 03:23 AM
                            0 responses
                            3 views
                            0 likes
                            Last Post GLFX005
                            by GLFX005
                             
                            Started by XXtrader, Yesterday, 11:30 PM
                            2 responses
                            12 views
                            0 likes
                            Last Post XXtrader  
                            Working...
                            X