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

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.
    Brandon H.NinjaTrader Customer Service

    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 alifarahani, 04-19-2024, 09:40 AM
      9 responses
      54 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by mmckinnm, Today, 01:34 PM
      2 responses
      5 views
      0 likes
      Last Post mmckinnm  
      Started by Conceptzx, 10-11-2022, 06:38 AM
      3 responses
      60 views
      0 likes
      Last Post NinjaTrader_SeanH  
      Started by f.saeidi, Today, 01:32 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by traderqz, Today, 12:06 AM
      9 responses
      16 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X