Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

I need help with multiple order entries

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

    I need help with multiple order entries

    Hi, I need help please. I need help on Multiple entries. For instance If an entry setup happens, and an order is open, and then 1 hr later another entry setup happens, then another order would be placed without closing the first first other. I need these others to placed independently in the same direction. Please see attached image. How can i achieve this with Ninjatrader?

    Thanks
    Attached Files

    #2
    Hello iamhamid,

    Thanks for your post.

    Each time a condition in the strategy becomes true and you call an Entry order method, such as EnterLong(), an order would be placed by the strategy.

    If you want to wait for the first order to be placed before placing the second order, and so on, you could control your logic by implementing a counter in the script.

    For example, you could create an int variable called something like 'TradeCounter' and set it to 0 by default. In your condition to place the first order, check if the variable is equal to 0. Then, within that condition call your Entry order method and increment the variable by 1. Then, create a condition for placing the second trade and check if 'TradeCounter' is equal to 1, place your second entry order, and increment the counter by 1. Then, create a condition for placing the third trade and check if 'TradeCounter' is equal to 2, and place your third trade and increment the variable by 1.

    You could set the variable to 0 when you are in a flat market position to reset the counter. Position.MarketPosition would be used to check if you are in a flat position.

    EntriesPerDirection and EntryHandling could be used to control the maximum number of entries allowed per direction while a position.

    If you set Entry Handling to EntryHandling.AllEntries, NinjaScript will process all entry order methods up to the maximum allowable entries set in the EntriesPerDirection property. For example, if you set EntriesPerDirection to 3 and use EntryHandling.AllEntries, up to a total of 3 entry orders will process.

    See the help guide documentation below for more information.

    EntriesPerDirection: https://ninjatrader.com/support/help...rdirection.htm
    EntryHandling: https://ninjatrader.com/support/helpGuides/nt8/entryhandling.htm
    Position.MarketPosition: https://ninjatrader.com/support/help...​​
    <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
      Hi Brandon, thanks for your help. I tried implementing this but i am not getting the desired result. Can you help with sample script in Strategy builder that shows the implementation on how to use counter for this situation
      ? So that i can compare with mine and see where the mistake lies. Thanks

      Comment


        #4
        Hello iamhamid,

        Thanks for your notes.

        There are no means to increment an int variable in the Strategy Builder. This would require unlocking the code from the Strategy Builder by clicking the 'Unlock code' button and manually programming the strategy in a NinjaScript Editor window.

        Instead of using a regular int variable, you could consider using a custom Series to accomplish this.

        You could view this forum thread which contains an example script that has a counter in a Strategy Builder strategy: https://forum.ninjatrader.com/forum/...86#post1099186
        <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

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        77 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X