Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using EntriesPerDirection & AtmStrategyCreate() together

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

    Using EntriesPerDirection & AtmStrategyCreate() together

    From within a Strategy I am using the AtmStrategyCreate() to generate entry orders that are then managed by an ATM. I have this portion working successfully using the following code. It calls the double 'entryPrice' and creates the ATM named "MyATMStrategy1" :

    {
    AtmStrategyCreate(Cbi.Action.Sell, OrderType.Limit, entryPrice, 0, TimeInForce.Day,
    GetAtmStrategyUniqueId(), "MyATMStrategy1", GetAtmStrategyUniqueId() );
    }

    My question involves the " EntriesPerDirection = 1; " command. The Strategy seems to completely ignore the EntriesPerDirection setting in the Initialize section of the Stratgey. Can EntriesPerDirection & AtmStrategyCreate(), in fact, be used together, or does the AtmStrategyCreate() somehow override the EntriesPerDirection setting?

    Thanks,
    Bill

    #2
    Hello,

    And welcome to the NinjaTrader support forum!

    Your finding are correct as EntriesPerDirection only relates to managed orders(Such as EnterLong() and EnterShort()). Since you are using an ATM Strategy this is not managed by the strategy therefor this parameter no longer pertains to it.

    You will need to code this EntriedPerDirection handling directly into your code by adding a counter variable is one way to do it.

    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Thanks, Brett.

      Do you have any sample code that would be helpful for this particular use?
      I want to able to 'stop & reverse' against an active position, too.

      Comment


        #4
        Hello,

        I unfortuantley do not have any sample code for this specific use. However you would just need to when you call ATMStrategyCreate() a counter variable and add 1 too it. Then do a check before submitting ATMStrategyCreate() that this counter variable is lower then the number that you do not want more then this many of trades per direction.

        Then use the following to tell when to minus one from your counter when an ATM Strategy is complted and either one of its stops or targets got hit (flat) to allow you to place another trade. Is one way to do it.



        You can use this also to then reverse the position should your entry conditions get met for a short.

        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment


          #5
          Excellent! Thank you, Brett

          All the Best,
          Bill

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          607 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          353 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          560 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          561 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X