Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

My strategy only takes one contract and I want it to take two

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

    My strategy only takes one contract and I want it to take two

    Hello.
    I'm implementing a strategy in the MES and I want to take two contracts per entry. It's a strategy that has no Stop Loss, so I will always be in the market, entering with 2 contracts and leaving with 2 contracts. My problem is that I don't understand why my strategy only takes one contract.
    Can you tell me where I'm wrong?

    Thank you.

    #2
    Hello Bitcoinvale,

    Thank you for your post.

    Entries per direction set to 2 would allow you to call EnterLong(1) twice. It does not have to do with the quantity per entry.

    So I may investigate this item further, please confirm how you are submitting the order. Are you entering the order like EnterLong(2) or are you using the DefaultQuantity parameter?

    In the example below, a buy order to enter 2 long positions is working provided that the close price of the current bar is greater than the current value of the 20-period simple moving average. If the entry condition is no longer true and the order is still active it will be immediately canceled.

    protected override void OnBarUpdate()
    {
    // Entry condition
    if (Close[0] > SMA(20)[0])
    EnterLong(2);
    }

    Additionally, more information about EnterLong() may be found in the NinjaTrader Help Guide link below.


    I look forward to assisting you further.
    <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
      Originally posted by NinjaTrader_BrandonH View Post
      Hello Bitcoinvale,

      Thank you for your post.

      Entries per direction set to 2 would allow you to call EnterLong(1) twice. It does not have to do with the quantity per entry.

      So I may investigate this item further, please confirm how you are submitting the order. Are you entering the order like EnterLong(2) or are you using the DefaultQuantity parameter?

      In the example below, a buy order to enter 2 long positions is working provided that the close price of the current bar is greater than the current value of the 20-period simple moving average. If the entry condition is no longer true and the order is still active it will be immediately canceled.

      protected override void OnBarUpdate()
      {
      // Entry condition
      if (Close[0] > SMA(20)[0])
      EnterLong(2);
      }

      Additionally, more information about EnterLong() may be found in the NinjaTrader Help Guide link below.


      I look forward to assisting you further.
      Perfect!!!
      Thank you so much!!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      88 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      135 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X