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