Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit After 2 Bars Complete

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

    Exit After 2 Bars Complete

    Wondering how to use Condition Builder to tell my strategy to exit a position after 2 Renko bars have completed. Looks like all my big losses involve holding beyond that point so closing the position even if profit target isn't hit after 2 bars would be very helpful.
    Thanks for the help!

    #2
    Please note ...

    I already tried "Bars Since Entry" = "2". "Bars Since Entry" > "2". "Bars Since Entry" =/> 2". "Bars Since Entry" = "3". With each of the above, "action" was "Exit Long" and "Exit Short".
    I also tried unchecking the "calculate at close" box (shot in the dark, one of hundreds).

    Deeply appreciate any help you can offer. Seems a simple parameter to input but it's giving me fits.

    Comment


      #3
      You use the condition builder dialog.
      Attached Files

      Comment


        #4
        Thanks but ...

        ... that is exactly what I've been trying and backtesting shows trades holding for 3 and 4 bars before exiting due to indicator reversal. Attached screen shots show my condition builder setup for getting out after 2 renko bars complete. Any other ideas? Anyone? Ninja "watchers"?
        Attached Files

        Comment


          #5
          Originally posted by TakingStock12 View Post
          ... that is exactly what I've been trying and backtesting shows trades holding for 3 and 4 bars before exiting due to indicator reversal. Attached screen shots show my condition builder setup for getting out after 2 renko bars complete. Any other ideas? Anyone? Ninja "watchers"?
          can you try on a non-renko chart, say 3 minutes, and see if it works there?

          there is also this post, where someone had to name their entries..i'm not sure what your entries look like, I guess you didn't name them?


          Comment


            #6
            Sledge ...

            ... excellent suggestions but no change on the 3 minute chart test and the referenced thread requires the use of ninjascript/coding which is beyond me. Seems rather odd that a function clearly available in the Condition Builder should simply not work. Frustrating. Such a simple thing condition to boot.
            Again - thanks very much for the very thoughtful ideas Sledge. I do appreciate your effort to help.

            Comment


              #7
              Sorry - I didn't reply directly to your post Sledge. My reply should show above. Thanks.

              Comment


                #8
                Originally posted by TakingStock12 View Post
                Sorry - I didn't reply directly to your post Sledge. My reply should show above. Thanks.
                I got it.

                Comment


                  #9
                  Originally posted by TakingStock12 View Post
                  ... excellent suggestions but no change on the 3 minute chart test and the referenced thread requires the use of ninjascript/coding which is beyond me. Seems rather odd that a function clearly available in the Condition Builder should simply not work. Frustrating. Such a simple thing condition to boot.
                  Again - thanks very much for the very thoughtful ideas Sledge. I do appreciate your effort to help.

                  I couldn't figure out a direct assignment in the wizard == 2.. but i used variable0.


                  set1 : if simple (ema>sma).. do: enterlong(defaultquantity, ""), variable0=2
                  set2: if BarsSinceEntry()==Variable0, do: exitlong("","");

                  i have no other conditions, calculateonbarclose=true.. it appears to exit on bar #3 on the renko chart with brick = 2. (which would be correct, unless caculatoronbarclose=false)

                  Comment


                    #10
                    Request ...

                    First, thank you so much for actually trying to figure this out! Very kind. Since I've never used user variables, would you mind posting screen shots of your inputs? It would be a great help although I will be trying to figure out how to make those inputs on my own in case you haven't the time. Again, thanks!

                    Comment


                      #11
                      Originally posted by TakingStock12 View Post
                      First, thank you so much for actually trying to figure this out! Very kind. Since I've never used user variables, would you mind posting screen shots of your inputs? It would be a great help although I will be trying to figure out how to make those inputs on my own in case you haven't the time. Again, thanks!

                      code ended up like this with view code:
                      Code:
                             protected override void Initialize()
                              {
                      
                                  CalculateOnBarClose = true;
                              }
                      
                              /// <summary>
                              /// Called on each bar update event (incoming tick)
                              /// </summary>
                              protected override void OnBarUpdate()
                              {
                                  // Condition set 1
                                  if (EMA(6)[0] > SMA(14)[0])
                                  {
                                      EnterLong(DefaultQuantity, "");
                                      Variable0 = 2;
                                  }
                      
                                  // Condition set 2
                                  if (BarsSinceEntry() == Variable0)
                                  {
                                      ExitLong("", "");
                                  }
                              }
                      
                              #region Properties
                              [Description("")]
                              [GridCategory("Parameters")]
                              public int MyInput0
                              {
                                  get { return myInput0; }
                                  set { myInput0 = Math.Max(1, value); }
                              }
                              #endregion
                      Attached Files

                      Comment


                        #12
                        But how did you get Condittion set 1 to include Variable0=2? Been trying to duplicate that to no avail. Sorry to be a bother.

                        Comment


                          #13
                          Originally posted by TakingStock12 View Post
                          But how did you get Condittion set 1 to include Variable0=2? Been trying to duplicate that to no avail. Sorry to be a bother.
                          Add button? i can post a pic in the morning..

                          post how u did ==2..

                          i cant find that. im on nt 7.1000.08..??

                          Sent from HTC Hero on the NOW network!

                          Comment


                            #14
                            here ...

                            From the code you were kind enough to show:

                            // Condition set 1
                            if (EMA(6)[0] > SMA(14)[0])
                            {
                            EnterLong(DefaultQuantity, "");
                            Variable0 = 2;

                            I'm using 7.10000.08 too.

                            In condition builder, I went to the "do" portion of set 1 where I have the EnterLong(DefaultQuantity,"") already there, hit the "..." to edit that hoping to enter the "Variable0 = 2" which is showing in your code but I can't figure out how to get the variable to input.

                            Comment


                              #15
                              See the attachment.

                              Originally posted by TakingStock12 View Post
                              From the code you were kind enough to show:

                              // Condition set 1
                              if (EMA(6)[0] > SMA(14)[0])
                              {
                              EnterLong(DefaultQuantity, "");
                              Variable0 = 2;

                              I'm using 7.10000.08 too.

                              In condition builder, I went to the "do" portion of set 1 where I have the EnterLong(DefaultQuantity,"") already there, hit the "..." to edit that hoping to enter the "Variable0 = 2" which is showing in your code but I can't figure out how to get the variable to input.
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              648 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              369 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              109 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              573 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              575 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X