Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Renko strategy has some incorrect exits

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

    Renko strategy has some incorrect exits

    Hi guys

    Please refer to the image below. I have a strategy based on Renko bars running on this chart.

    My exit conditions for short trades are coded as follows:

    if (Position.MarketPosition == MarketPosition.Short
    && Close[0] > Open[0])
    { ExitShort("ShortExit", "Short");}
    So a short trade is exited at the first up Renko bar.

    The left hand box shows a correctly executed exit at the top of the up bar.

    The right hand box shows an incorrectly executed exit at the bottom of the up bar.

    Looking thru the chart, I see that the exits (for short trades) are correctly executed if and only if the up exit bar is followed by another up bar.

    If the up exit bar is followed by a down bar, that's when the exit seems to go wrong.

    (The reverse is true for long trades.)

    Is it me missing something obvious - or is the system at fault somewhere?

    Many thanks in advance for your help.

    Click image for larger version

Name:	Incorrect exit A.JPG
Views:	1
Size:	62.3 KB
ID:	898631

    #2
    Hi arbuthnot,

    The strategy should submit orders as it's programmed to do and everything in that screenshot seems to be consistent with this.

    The candle right before your exit is a green one, which means that the Close[0] > Open[0]. This happens to be the same condition as your exit condition.

    You are always going to see this order timing on historical (backtest) bars: Condition true > Order submitted to next bar.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks very much, Ryan.

      You say

      You are always going to see this order timing on historical (backtest) bars: Condition true > Order submitted to next bar.
      Following what you say, and looking at the chart, I see why this happens on historical (backtest) bars. But would the correct situation obtain (i.e the trade is exited two bar lengths higher than the bottom of the lowest bar) when the strategy is running and trading in real-time?

      Thanks again for letting me know.

      Comment


        #4
        In real time you can set CalculateOnBarClose = false, and then conditions are evaluated for the currently forming bar. If the condition is true, then orders are submitted right away.

        But would the correct situation obtain (i.e the trade is exited two bar lengths higher than the bottom of the lowest bar)
        That's not necessarily what it will do since that's not the condition you defined. You defined Close[0] > Open[0] and that's what needs to be true before it proceeds with the actions below.
        Last edited by NinjaTrader_RyanM1; 06-14-2012, 03:41 PM.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Much obliged to you. Ryan, for clarifying the situation.

          Am I possibly right in thinking that a workaround for this (for Renko bars = 4, for example) would be this:

          1) Set CalculateOnBarClose = false

          2) Introduce a SetTrailStop for the ticks equivalent of two bar lengths. So in this case, the trail stop would be set to 8 ticks.

          (I know this wouldn't work with backtesting as tick data is lost.)

          Thanks for your conformation that this might work.

          Comment


            #6
            You can use SetTrailStop() in your strategy and if you have any questions on it I'm happy to clarify. What is the item you're trying to work around?
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            651 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            370 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
            574 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            577 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X