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:	298
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 CarlTrading, 03-31-2026, 09:41 PM
                    1 response
                    41 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by CarlTrading, 04-01-2026, 02:41 AM
                    0 responses
                    20 views
                    0 likes
                    Last Post CarlTrading  
                    Started by CaptainJack, 03-31-2026, 11:44 PM
                    0 responses
                    28 views
                    1 like
                    Last Post CaptainJack  
                    Started by CarlTrading, 03-30-2026, 11:51 AM
                    0 responses
                    45 views
                    0 likes
                    Last Post CarlTrading  
                    Started by CarlTrading, 03-30-2026, 11:48 AM
                    0 responses
                    37 views
                    0 likes
                    Last Post CarlTrading  
                    Working...
                    X