Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get Free Margin in NinjaScript?

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

    How to get Free Margin in NinjaScript?

    Hi, I am trying to figure out how to get the free margin value in Ninjascript. I am able to get the Cash Value and Net Liquidation, etc., etc.. but all of the margins always have a zero value?

    Here is the code I am using and it works but always returns a 0 value?

    Code:
    double freeMargin = account.Get(AccountItem.InitialMargin, Currency.UsDollar);
    The margin values in this pic never change even if there are a bunch of positions open.


    Click image for larger version

Name:	image.png
Views:	272
Size:	5.9 KB
ID:	1340560
    TIA​


    #2
    Hello defa0009,

    May I confirm you are placing orders to a live account or live demo (and not the Sim101)?

    Who is your broker?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      It's development so a sim demo account.

      Comment


        #4
        Hello defa0009,

        Have you applied a Risk template to the Sim101 account?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          No idea what that is?

          Comment


            #6
            Hello defa0009,

            For the Sim101 to show margin while a position is open, a Risk template must be applied to the sim account.



            A live or live demo account would have the margin reported from the brokerage.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thanks... wasn't aware I had to do that.

              Is the InitialMargin the free margin? I see like 4 different fields with the word margin in them.

              Comment


                #8
                Hello defa0009,

                Likely you are describing the 'Excess Intraday Margin'.

                From the help guide linked above:
                "Available (unused) intraday margin on the account"
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  I'm not sure... just looking to get the fee margin so I can stop a margin call that closes all trades.

                  Comment


                    #10
                    Originally posted by defa0009 View Post
                    I'm not sure... just looking to get the fee margin so I can stop a margin call that closes all trades.
                    Hi Defa009,

                    To get the margin you have 2 option until I know, check the website → https://ninjatrader.com/pricing/margins/ or go and use a demo account and just make a trade at the instrument you would like to know the margin... just there the CC will show you the Intraday margin and initial margin that you showed in the pic. I prefer the last option because is already update it

                    I dont know if we can get it before to make the trade

                    Cheers

                    Fz

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    547 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    323 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    99 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    543 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    545 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X