Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetProfitTarget Gives Margin Error

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

    SetProfitTarget Gives Margin Error

    Hi there,

    I am submitting a Long Position using the below code. The SetProfitTarget is giving the following error:

    Code:
    16/09/2024 10:22:32 pm,Order,SimLiveStaging Order '2a089083ec814d9ab67a769e83944fb9' can't be submitted: Not enough excess margin. affected Order: Buy 1 Market
    I have 184 USD in my SIM Account and I am trading MNQ for which the Margin requirement is 100 USD. Why is it that when I am placing ProfitTarget via strategy it is giving me the margin error but when doing the Same using ATM, it is working.

    Code:
    double stopLossLevel = Close[0] - (atrMultiplier * atrValue);
    double takeProfitLevel = Close[0] + (riskRewardRatio * (Close[0] - stopLossLevel));
    
    //SetStopLoss(CalculationMode.Price, stopLossLevel);
    
    SetProfitTarget(@"EnterLong" + CurrentBar,CalculationMode.Price, takeProfitLevel);
    SetStopLoss(@"EnterLong" + CurrentBar,CalculationMode.Ticks, StopLoss_Ticks,false);
    
    
    EnterLong(0,1, @"EnterLong"+CurrentBar);

    #2
    Hello FossilBlade,

    If you are submitting orders which encounter margin rejections you would either need to adjust the order to be within your margin or reset the sim account to increase its values. To edit the sim account you can use the accounts tab of the control center and then right click -> edit account.

    Comment


      #3
      The issue is why is this happening from Startegy only and will it happen on live account as well ?

      Placing a take profit target a d stop loss order should not use the margin, so why is it giving this error for Profit target.

      I also noticed that none of the profit target oder which is fsiling is "Buy to cover" instead of ProfitTarget.

      With the same balance using Ninja trader ATM works fine. It places take profit and SL order correctly.

      Comment


        #4
        Hello FossilBlade,

        Yes this can also happen on a live account when exceeding account margin values.

        The error you are seeing is for a Buy 1 Market order which is your entry order and not the targets. Your condition to trade likely became true again while you were already in a position, if you only have 184$ and the margin is 100$ you have exceeded that by trying to put in another order.

        Comment


          #5
          Hi, there Please refer to this example. It is a Profit target order which got rejected due to excess margin.

          Code:
          17/09/2024 10:00:01 am,Order,SimLiveStaging Order '4ea6eb9f73104819ae75ac3b510c565a' can't be submitted: Not enough excess margin. affected Order: Sell 1 Limit @ 19445.5,
          17/09/2024 10:00:01 am,Order,Order='4ea6eb9f73104819ae75ac3b510c565a/SimLiveStaging' Name='Profit target' New state='Rejected' Instrument='MNQ SEP24' Action='Sell' Limit price=19445.5 Stop price=0 Quantity=1 Type='Limit' Time in force=DAY Oco='5f6f3393c7724d7586b3ec8a1ffabb8b' Filled=0 Fill price=0 Error='Unable to submit order' Native error='Order '4ea6eb9f73104819ae75ac3b510c565a' can't be submitted: Not enough excess margin.',

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          53 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          130 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          70 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          44 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          49 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X