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

How to check whether account margin is enough to open position

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

    How to check whether account margin is enough to open position

    Hello,

    If i try to open position with too large size I have Ninja's message box "cannot accept order... not enough excess margin"

    I want to check before sending order whether I have enough margin to open position
    I suppose I need to use Account.GetAccountItem method, but I don't know which exactly parameter I have to use and what formula must be to get the answer "enough/not enough"

    I opened the related documentation


    but have not found any description for values

    #2
    Hello rfsettling,

    Thank you for your note.

    I have attached a sample strategy which checks initial margin before entering long.

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thanks
      One quick question: in your example Quantity of entry is not involved in calculation. If I use Quantity>1, should I multiply margin to my quantity?

      Comment


        #4
        Hello rfsettingling,

        Good point. I would test the following,

        Code:
        	if(xAccountSize > StratInstrumentInitialMargin * TradeSize)
        				EnterLong(TradeSize);
        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          I already experimented with it, but it seems the logic is different to simple mutliplication. Let's consider ES futures. Initial margin $4950. If it is for one contract, then opening 20 contracts is maximum I can send for 100 K deposit. But I sent 50 contracts and more and Ninja accepted those orders

          I tried to read user's manual for Risk window, to understand what each parameter means, but it also contains very scarce information.

          Comment


            #6
            Hello rfsettling,

            If you open a super dom and queue up fifty and submit the order, does NinjaTrader accept the order?

            I look forward to your reply.
            Alan P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by warreng86, 11-10-2020, 02:04 PM
            6 responses
            1,360 views
            0 likes
            Last Post mathewlo  
            Started by Perr0Grande, Today, 08:16 PM
            0 responses
            5 views
            0 likes
            Last Post Perr0Grande  
            Started by elderan, Today, 08:03 PM
            0 responses
            9 views
            0 likes
            Last Post elderan
            by elderan
             
            Started by algospoke, Today, 06:40 PM
            0 responses
            10 views
            0 likes
            Last Post algospoke  
            Started by maybeimnotrader, Today, 05:46 PM
            0 responses
            14 views
            0 likes
            Last Post maybeimnotrader  
            Working...
            X