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.
    https://ninjatraderecosystem.com/use...er-dom-column/

    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:
    https://ninjatrader.com/support/foru...-time-question

    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

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by MohammedAmine, Today, 10:44 AM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Kate  
                Started by Nolyn, Today, 10:59 AM
                0 responses
                1 view
                0 likes
                Last Post Nolyn
                by Nolyn
                 
                Started by Gkomi, Today, 10:02 AM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_Jim  
                Started by JTizz, Today, 08:58 AM
                6 responses
                30 views
                0 likes
                Last Post NinjaTrader_PaulH  
                Started by Bob49, Today, 08:40 AM
                0 responses
                19 views
                0 likes
                Last Post Bob49
                by Bob49
                 
                Working...
                X