Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Closing Position on Fully Leveraged Rithmic account

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

    Closing Position on Fully Leveraged Rithmic account

    Hello,

    I'm having problems with one of my trading accounts. I'm having trouble getting out of a position. It throws up the error:

    "Rejected at RMS - Total sell quantity of account would exceed its limit"

    It is a new Funded Topstep account. The maximum number of contracts according to the scaling plan is 2.

    I use the Addons/Accounts API to create and submit orders using some ChartTrader custom UI code.


    The flow that causes the error is as follows:

    Submit Market order for 1 contract.
    When the market order is filled, Submit a Limit Order (target) and a Stop Market Order (stop-loss)
    Submit Market order for a second contract
    When the market order is filled, Submit a Limit Order (target) and a Stop Market Order (stop-loss)

    I am now at Max leverage on this account. With an open position of 2 contracts, Plus 2 Limit target orders and 2 StopLoss orders.

    I want to close the position at the market.

    So I'm doing the following:

    firstly. Cancel the stop-loss and target orders;

    account.Cancel(new [] { target1, stop1, target2, stop2 });

    Then submit a market order to flatten the account:

    account.CreateOrder(....)

    at this point it throws up the Error: "Rejected at RMS - Total sell quantity of account would exceed its limit"


    I believe the issue is the timing of the requests. When the Market Order to flatten the account is submitted, the stop/target orders haven't fully been cancelled. At least one order is still active, and therefore the market order to exit the position plus the not-yet-cancelled stop/target orders would take me over the position size limit.

    The issue only seems to happen on one account. A new TopStep Express Funded account. I'm able to reproduce it very consistently. But it doesn't happen on any other accounts. Even a Practice account that TopStep has set up with the same parameters.

    Is there anything incorrect with the flow I'm using to close this position?

    A "Thread.Sleep(100)" resolves things after the account.Cancel() request. But this is not an idea solution. I also can't use account.Flatten() as The code in question keeps track of its Brackets and knows that it is managing a position of 2... There might be other positions open under normal circumstances.

    #2
    Hello kevinenergy,

    Thanks for your post.

    You would need to wait for the cancel of the stop/target orders to complete before submitting your market order to exit the position.

    OnOrderUpdate() could be used to track order objects and detect if the stop/target orders OrderState == OrderState.Cancelled and then you could submit your market order to close the position.

    See the help guide documentation and reference sample below for more information.

    OnOrderUpdate(): https://ninjatrader.com/support/help...rderupdate.htm
    SampleOnOrderUpdate(): https://ninjatrader.com/support/help...and_onexec.htm

    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hello! I had the same problem using the max leverage on my trading combine topstep account. Did you solve the problem ?

      Comment


        #4
        Originally posted by kevinenergy View Post
        Cancel the stop-loss and target orders;
        Old thread, I know, but my answer below may be
        helpful to future readers.

        -=o=-

        Cancel everything first?
        This approach may be contributing to your problem.

        Read this thread, pay particular attention to the NT7 link
        that describes the behavior of Chart Trader's Close button.

        The NT8 Close behavior is not all that relevant here, but
        read and study the NT7 behavior very closely.

        My point is:
        I suggest you mimic the same NT7 behavior, where by you
        immediately adjust the Target orders so they fill instantly,
        then cancel the Stop orders, and then submit a Market
        order, if necessary, to close any runners that remain.

        The idea is the NT7 rationale described in the 'Why not
        just submit a market order?' section of the above link may
        also be effective when bumping up against max contract
        limits (which may essentially be margin limitations under
        the hood, I dunno).

        I suggest you try this technique to see if it solves your
        problem.

        Just my 2˘.



        Comment

        Latest Posts

        Collapse

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