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 NullPointStrategies, Today, 05:17 AM
      0 responses
      20 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      119 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      63 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      45 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X