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

Help With Eliminating Re-Entry

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

    Help With Eliminating Re-Entry

    I am currently trying to build a strategy using the standard NinjaTrader Indicator, Swing.

    I have programmed it as:

    Close < Swing High
    Then
    Enter Long Position With Stop Order, @ Swing High (offset +1)

    Basically if the price is currently below the Swing High it will place the order one tick above it. Very simple.

    However, I am having trouble trying to figure out how to avoid, or eliminate, a re-entry on the third bar. See Picture.

    If bar two closes back under the swing high, a new entry is then valid and pending. I want to eliminate this, im assuming by making the bar since entry or exit greater than two? but It is not working properly, please help!

    Thanks in advance,
    Attached Files

    #2
    fibbee, according to the logic you have programmed the entry would be expected and correct, since you don't have a detection for 'is a new swing high / level'. You would for example run a bar counter since the entry triggered and demand this to be higher than x before any new entry long at the same level would be allowed. Cleaner would be keeping track of swing levels that triggered trades and not allowing trades to happen again at those levels for example in the current session / day.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hey Bert,

      I'm also having the same issue. I have tried a bar-counter that didn't work. I also have tried every combination of bars since entry or bars since exit. I am proficient with strategy wizard but am C# illiterate.

      I am trying to build a similar strategy and hoping to learn how to program;

      if time since last trade is less than 10 minutes don't place a new trade...

      Comment


        #4
        You could for example consider the following example I've attached as courtesy, the script would implement a waiting for x bars after the last entry point identified.

        For more coding example you could directly run on your end and review, please see this rich collection of samples we have here - http://www.ninjatrader.com/support/f...splay.php?f=30
        Attached Files
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Swing

          I have just created a strategy based on the discussion below.

          When close < swing high

          Go long with stop order @ swing high + 1 tick.

          However it is not working?

          Please advise.

          Comment


            #6
            Hello twitch,
            To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

            Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

            I look forward to assisting you further.

            *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              Rather than have a bar counter, would it be possible to program the strategy to make an entry price void once it has been met.

              In other words, is it possible to program a strategy so that it does not take more than one entry at the same price?

              Thanks.

              Comment


                #8
                Hello fibbee,
                Unfortunately there are no native method to do it. You can however custom code your strategy further to do it.

                You may refer to the Position.AvgPrice function which lets you to determine the average entry price of the positions.
                JoydeepNinjaTrader Customer Service

                Comment


                  #9
                  I am not a coder but I do use the wizard to create strategies (not successfully yet.)

                  Have you tried using "Position.MarketPosition==MarketPosition.Flat" as part of the strategy? This would only allow and entry if you are flat. It should allow the first entry and prevent the second.

                  Good luck!
                  Last edited by JMont1; 12-10-2012, 09:13 PM.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by frankthearm, Today, 09:08 AM
                  6 responses
                  24 views
                  0 likes
                  Last Post frankthearm  
                  Started by maybeimnotrader, Yesterday, 05:46 PM
                  3 responses
                  23 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by adeelshahzad, Today, 03:54 AM
                  5 responses
                  32 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by stafe, 04-15-2024, 08:34 PM
                  7 responses
                  32 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by merzo, 06-25-2023, 02:19 AM
                  10 responses
                  823 views
                  1 like
                  Last Post NinjaTrader_ChristopherJ  
                  Working...
                  X