Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pre-trade data calculations

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

    Pre-trade data calculations

    Before one submits an FX entry order of a known position size, how can one accurately calculate:

    1. The commissions (entry and exit), based on commissions data entered into NT7 for the relevant instrument.
    2. The margin that will be consumed, based on margin data entered into NT7 for the relevant instrument.

    Thanks.
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    #2
    Hello jeronymite,

    Thanks for your post.

    Regrettably the information in not available through ninjascript. You would need to create variables to hold the information for commission and margin.

    Comment


      #3
      Pre-trade data calculations

      Thanks for your reply, Paul.

      I understand that the data may not be available in a supported manner in NT7, but as one of your NT8 beta testers in this new age where NinjaTrader is being so helpful in identifying ways to do the "unsupported", I would be most grateful for the relevant magic to do this in an unsupported way, if it is at all possible for it to be done. Obviously, I will have no expectation of support for the unsupported.

      Many thanks!
      Multi-Dimensional Managed Trading
      jeronymite
      NinjaTrader Ecosystem Vendor - Mizpah Software

      Comment


        #4
        Hello jeronymite,

        Thank you for your patience.

        I am not aware of the exact means to do this, but I will look into this further.

        Comment


          #5
          Hello jeronymite,

          Thank you for your patience.

          Commission in NT 7: Instrument.MasterInstrument.GetCommission(1, Provider.Replay)
          Here you type the Provider. and then select your data provider that you want the information from.

          Margin in NT 7: Instrument.MasterInstrument.Margin

          Please let me know if you have any questions.

          Comment


            #6
            Pre-trade data calculations

            Many thanks for looking into this, Patrick -- very much appreciated!

            I can see that would work with just the MasterInstrument. How does one do this when one has many instruments added to the strategy? For example, I run with 28 Forex DataSeries added to my strategy and I want to be able to calculate on any of those prior to trade submission on the relevant instrument.

            Many thanks!
            Multi-Dimensional Managed Trading
            jeronymite
            NinjaTrader Ecosystem Vendor - Mizpah Software

            Comment


              #7
              You would use Instruments[barsInProgress Index] in place of Instrument. For example:
              Code:
              Instruments[1].MasterInstrument.Margin

              Comment


                #8
                Pre-trade data calculations

                Many thanks, Patrick!

                One last question, if I may: Given that GetCommission requires a Provider, how can one determine the Provider of the current strategy?

                I can obtain the Connection name, status, adapter, etc ... but Provider?

                Thanks again!
                Multi-Dimensional Managed Trading
                jeronymite
                NinjaTrader Ecosystem Vendor - Mizpah Software

                Comment


                  #9
                  Pre-trade data calculations

                  On further investigation, I believe it should be:
                  Code:
                  Account.Connection.Options.Provider
                  Grateful for your confirmation, Patrick. Thanks!
                  Multi-Dimensional Managed Trading
                  jeronymite
                  NinjaTrader Ecosystem Vendor - Mizpah Software

                  Comment


                    #10
                    That would be correct.
                    Code:
                    Instrument.MasterInstrument.GetCommission(1, Account.Connection.Options.Provider)

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    630 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    364 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    105 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    566 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    568 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X