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

Read Order Flow Trade Detector Indicator Values in NinjaScript C#

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

    Read Order Flow Trade Detector Indicator Values in NinjaScript C#

    Hi,

    I need some help about Order Flow Trade Detector Indicator. This indicator plots balls on the chart. When I mouse over an OFTD ball, I can see the 4 metrics "S" (Sell Volume), "B" (Buy Volume), "V" (total volume) and "P" (price) as shown in the attached screen shot.

    I'm developing a custom indicator using NinjaScript in NinjaTrader 8. I need to access these values, "S" (Sell Volume), "B" (Buy Volume), "V" (total volume) and "P" (price) in my NinjaScript C# code. I have experienced reading indicator values from the plotted lines on a chart (i.e. I can read values of an SMA plotted line or Stochastic lines from the chart in
    NinjaScript). However, I'm not sure whether the Order Flow Trade Detector values can be read from the chart like this or not because it is not plotted as lines.

    Please guide me how can I do this. I would be really thankful if it is possible to share some syntax or example/similar code that has relevancy to my need.

    Best Regards,
    Mubeen Haider
    Attached Files

    #2
    Hello Mubeen Haider,

    Thank you for your post.

    It would not be possible to access the Order Flow + Trade Detector values from NinjaScript. Further, the code for the Order Flow Trade Detector is closed source, so even we in the Support department do not have access to the calculations it uses to get those values.

    That being said, I have added a vote for you to a current feature request to allow access to the Order Flow + items that are not currently accessible from NinjaScript. This request is being tracked under the number SFT-4377.

    As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

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

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thanks very much dear Kate for your answer. I would be grateful if you could help me a little further.

      My objective is to get the buy and sell volume of a bar in the NinjaScript. There exists a function called "AddVolumetric()" as described in this webpage:

      If, in my code, I add an Order Flow Volumetric Bar/Series through AddVolumetric() function and pass the Primary instrument name, Primary BarsPeriodType and BarsPeriodValue to it.
      Then I use the "TotalBuyingVolume" and "TotalSellingVolume" properties of the Volumetric bars as mentioned in this webpage:


      Do you think this would serve as an alternative way of getting the buy/sell volumes shown by Order Flow Trade Detector Indicator values on the chart?
      My code will look something like this.

      else if (State == State.Configure)
      {
      AddVolumetric(Instrument.FullName, BarsPeriod.BarsPeriodType, BarsPeriod.Value, VolumetricDeltaType.BidAsk, 1);
      }
      protected override void OnBarUpdate()
      {
      if (BarsInProgress == 1)
      {
      NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsType as
      NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
      if (barsType == null)
      return;
      Print("Total Buying Volume: " + barsType.Volumes[CurrentBar].TotalBuyingVolume);
      Print("Total Selling Volume: " + barsType.Volumes[CurrentBar].TotalSellingVolume);
      }
      }

      I welcome if you can suggest a better way of doing this.
      Thanks and Best Regards,
      Mubeen Haider

      Comment


        #4
        Hello Mubeen Haider,

        Thank you for your reply.

        This would be exactly what I'd recommend for getting buy and sell volumes. Alternatively you could sum up ask and bid volumes in OnMarketData, but what you've got would certainly be simpler.

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hi Kate, Your recommendations have been very helpful for me. I'm so thankful for your guidance. Before we close the discussion, I request you to answer one last question. Rest I have sorted out.

          "AddVolumetric(Instrument.FullName, BarsPeriod.BarsPeriodType, BarsPeriod.Value, VolumetricDeltaType.BidAsk, 1)" does not work well when BarsPeriodType is Renko, I mean the chart is Renko based. It gives the following exception:

          "System.InvalidOperationException: 'Renko' cannot be used as base bars period type for 'Volumetric'".

          Can you help me how to get rid of this exception. I need to add volumetric on a chart where primary Data Series/bar type is based on Renko.
          Best Regards,
          Mubeen Haider

          Comment


            #6
            Hello Mubeen,

            Thank you for your reply.

            It would not be possible to add a Volumetric series with a base BarsPeriodType of Renko. Valid base bars period types for Volumetric bars are as follows:
            • BarsPeriodType.Tick
            • BarsPeriodType.Volume
            • BarsPeriodType.Range
            • BarsPeriodType.Second
            • BarsPeriodType.Minute
            • BarsPeriodType.Day
            • BarsPeriodType.Week
            • BarsPeriodType.Month
            • BarsPeriodType.Year
            You would have to have your added Volumetric series use one of these.

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Hi, I’m very interested in having the Order Flow + Trade Detector indicator available for use within NinjaScrypt.

              Could someone please add my vote for this new feature request? It is my understanding that this request is being tracked under the number SFT-4377.

              Thanks.

              Comment


                #8
                Hi, I would also like to have my vote added to the request of having the Order Flow + Trade Detector Indicator available for use within NinjaScript It is my understanding that this request is being tracked under the number SFT-4377.
                Thanks.


                Comment


                  #9
                  Hello villa and Sergio Villaverde,

                  Thanks for your posts.

                  I have added your votes for this feature request.

                  As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

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

                  Please let us know if we may be of further assistance to you.​
                  Brandon H.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by timmbbo, Today, 08:59 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post timmbbo
                  by timmbbo
                   
                  Started by bmartz, 03-12-2024, 06:12 AM
                  5 responses
                  33 views
                  0 likes
                  Last Post NinjaTrader_Zachary  
                  Started by Aviram Y, Today, 05:29 AM
                  4 responses
                  14 views
                  0 likes
                  Last Post Aviram Y  
                  Started by algospoke, 04-17-2024, 06:40 PM
                  3 responses
                  28 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by gentlebenthebear, Today, 01:30 AM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Working...
                  X