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

enter once per candle

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

    enter once per candle

    how do i get a nina script to only enter once per candle can this be done on the strategy builder or must it be programmed manually

    #2
    Hello,

    When you attach a strategy to a chart or the strategy tab you will be given the option to change the Entry handling. Please change this to UniqueEntries and only one order will be sent per Entry signal.

    You can also accomplish this with the EntriesPerDirection field set to 1.
    Last edited by NinjaTrader_Ben; 09-12-2008, 08:30 AM.
    DenNinjaTrader Customer Service

    Comment


      #3
      I'd like to know more about preventing multiple entries per candle too.

      The problem that I am trying to prevent is this:

      1) Conditions are met for trade entry and a limit order is placed by the system with profit target and stop loss orders attached.

      2) In that same candle, the profit target is met so the the position is then closed with the stop limit order.

      3) However entry conditions still apply so NT then initiates another limit purchase order in the same bar.

      I am trying to prevent part three happening - ie only one entry and exit position is allowable per bar.

      It seems that UniqueEntries just prevents multiple concurrent positions , not sequential positions within the same bar.

      I have no problems coding a solution, I'm just unsure what code is required to resolve this.

      Thanks

      Chris

      Comment


        #4
        Hello,

        I suggest you use BarsSinceEntry(). For example:

        // Only enter if at least 10 bars has passed since our last entry
        if (BarsSinceEntry() > 10 && CrossAbove(SMA(10), SMA(20), 1))
        EnterLong();


        This link will help:
        http://www.ninjatrader-support.com/H...inceEntry.html
        DenNinjaTrader Customer Service

        Comment


          #5
          Hi Ben

          Thanks for the speedy reply.

          BarsSinceEntry() didn't seem to work properly however I have resolved the issue now by setting, and testing for, a variable such as doneForSession if an entry and exit have been made for the candle.

          This technique is used in this example code:



          Many thanks for your help
          Chris

          Comment


            #6
            Hi Chris,

            Glad you got it resolved. The BarsSinceEntry() condition may require you to code the first trade instance separate from the rest because if you have never traded BarsSinceEntry() will always be zero.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Having trouble with multiple orders

              I want to limit the number of active orders to just 1, I have tried the order handling techniques and the bars since entry but am having no success, can someone help me out here?

              Comment


                #8
                Sleeping Troll, can you please show us what you have so far? What happens if you set the entries per direction to 1? Do you still get multiple orders?
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  Please let me know how to code this

                  Originally posted by Operandi View Post
                  Hi Ben

                  Thanks for the speedy reply.

                  BarsSinceEntry() didn't seem to work properly however I have resolved the issue now by setting, and testing for, a variable such as doneForSession if an entry and exit have been made for the candle.

                  This technique is used in this example code:



                  Many thanks for your help
                  Chris
                  Hi,
                  Please let me know how to code this.

                  Comment


                    #10
                    Hello skann29,

                    Thank you for your post and welcome to the NinjaTrader Support Forum!

                    You can find the sample referenced at the following link: http://www.ninjatrader.com/support/f...ead.php?t=5790

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by rene69851, 05-02-2024, 03:25 PM
                    1 response
                    20 views
                    0 likes
                    Last Post rene69851  
                    Started by ETFVoyageur, Yesterday, 07:05 PM
                    5 responses
                    43 views
                    0 likes
                    Last Post ETFVoyageur  
                    Started by jpeep, 08-16-2020, 08:31 AM
                    13 responses
                    487 views
                    0 likes
                    Last Post notenufftime  
                    Started by realblubb, 04-28-2024, 09:28 AM
                    2 responses
                    32 views
                    0 likes
                    Last Post realblubb  
                    Started by bmarovets, Today, 06:33 PM
                    0 responses
                    12 views
                    0 likes
                    Last Post bmarovets  
                    Working...
                    X