Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATM Strategy Limiting entries per direction

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

    ATM Strategy Limiting entries per direction

    I need some guidance limiting entries per direction with my MTF strategy. I am using operator comparisons for the conditions, but I would like it to behave as if it were a crossover condition, thereby only entering once per direction when all operator conditions have been met. I thought I would use a crossover condition for BarsArray[0] but I believe that would limit my entry opportunities too greatly.

    I've read I should use OnExecution() and a bool variable, but frankly I don't understand how that works.

    Thanks in advance

    #2
    Hello MisterGee,

    Thanks for your post.

    If I understand correctly you have an ATM strategy and you are placing entry orders based on MTF logic. Can you clarify if you are using CalculateOnBarClose = false? (This operates on each tick of the bar and as such conditional statements can quickly change and change back as the price oscillates).

    Are you bracketing your entry logic according to the BarsInProgress? If not this would also cause multiple order as each bars object will call OnBarUpdate(). Please review the helpguide here for further references: http://ninjatrader.com/support/helpG...nstruments.htm


    You can use bool logic to control entries once an entry condition has been met. For example:

    if (your logic to enter a position && doitonce)
    {
    // entry order here
    doitonce = false; // set this bool false so it will only perform the entry once
    }


    Later you would need logic to reset the bool so that when you next are ready to order you will be able to. A common way to do this is to reset when your are flat. For example:

    if (Position.MarketPosition == MarketPosition.Flat)
    {
    doitonce = true; // reset for next entry order
    }


    Note: you would declare the bool in "region Variables" as follows;
    private bool doitonce = true; // start with true
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      I've been using COBC = false
      I have:
      if (bars in progress != 0)
      Return;
      In place, if that's what you're referring to?

      Using the bool variable like this I can avoid using OnExecution ()?

      Comment


        #4
        Hello MisterGee,

        Thanks for your post.

        With your code in OnBarUpdate() protecting again executing on other barsseries, adding the bools as previously posted should prevent multiple entries. Your code will execute once per tick from top to bottom of the code. Once the entry is sent the bool is set to false, on the next tick the bool will be false and no order should be sent.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Perfect, and the bool should remain false until the position is flat.

          I will implement this. Thank you very much!

          Comment


            #6
            Update

            I found this solution to work perfectly when COBC is set to true.. when it is set to false orders are being submitted every tick, flat or not. I must've missed something?

            Comment


              #7
              Hello MisterGee,

              Thanks for your post.

              It is difficult to reply without the detail of your code. So that I can assist, please post your code or alternatively send in your strategy to PlatformSupport[at]Ninjatrader[dot]com with Atten:Paul and a link to this thread in the title.
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Hello MisterGee,

                I meant to ask if you would also advise what your settings are for EntriesPerDirection and EntryHandling.
                Paul H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by elirion, Today, 01:36 AM
                0 responses
                3 views
                0 likes
                Last Post elirion
                by elirion
                 
                Started by gentlebenthebear, Today, 01:30 AM
                0 responses
                4 views
                0 likes
                Last Post gentlebenthebear  
                Started by samish18, Yesterday, 08:31 AM
                2 responses
                9 views
                0 likes
                Last Post elirion
                by elirion
                 
                Started by Mestor, 03-10-2023, 01:50 AM
                16 responses
                390 views
                0 likes
                Last Post z.franck  
                Started by rtwave, 04-12-2024, 09:30 AM
                4 responses
                34 views
                0 likes
                Last Post rtwave
                by rtwave
                 
                Working...
                X