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 zstheorist, Today, 07:52 PM
      0 responses
      5 views
      0 likes
      Last Post zstheorist  
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      150 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Started by mattbsea, Today, 05:44 PM
      0 responses
      6 views
      0 likes
      Last Post mattbsea  
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      33 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by tkaboris, Today, 05:13 PM
      0 responses
      6 views
      0 likes
      Last Post tkaboris  
      Working...
      X