Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Renko problems

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

    Renko problems

    I have created a simple strategy that uses Renko bars. The problem is that sometimes my trades are entered exactly where I specified and sometimes they are completely wrong. In history performance everything looks perfect but when testing in reply it's hit and miss. Why is this?

    Here's my code:
    Code:
            protected override void Initialize()
            {
                SetProfitTarget("", CalculationMode.Ticks, ProfitTarget);
                SetStopLoss("", CalculationMode.Ticks, StopLoss, false);
    
                CalculateOnBarClose = true;
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
    
    
                // Condition set 1
                if (ToTime(Time[0]) > ToTime(8, 30, 0)
                    && ToTime(Time[0]) < ToTime(14, 55, 0)
                    && Position.MarketPosition == MarketPosition.Flat
                    && CrossAbove(DMplus(ADXPeriod).DiPlus, DMplus(ADXPeriod).DiMinus, 1))
                {
                    EnterLong(DefaultQuantity, "");
                }
    
    
                // Condition set 2
                if (CrossBelow(DMplus(ADXPeriod).DiMinus, DMplus(ADXPeriod).DiPlus, 1))
                {
                    ExitLong("", "");
                }
            }
    Attached Files
    Last edited by relogical; 06-27-2012, 06:02 PM.

    #2
    relogical, due the way Renko bars are constructed there can be discrepancies unfortunately experiecenced comparing backtest results to realtime / market replay where the actual intrabar formation would be available. To better understand the issues your script faces, I would suggest adding visual confirmation of an entry, so you know exactly when your programmed in conditions would trigger, this can be done for example with drawing dot / arrow via the NinjaScript methods available.

    With more advanced custom coding, a more realistic backtest results could be likely achieved by submitting your orders to a finer granularity (for example a 1 tick series), here's a sample how this would be approached - http://www.ninjatrader.com/support/f...ead.php?t=6652
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I noticed that trades are not executed on target when it's a fast moving security. When I use something less volatile the buy/sell trades are correct. Does this happen because the NT software is just not able to place trades on fast moving securities?

      Comment


        #4
        relogical, the speed should not matter, we have many high frequency traders using our product every day.

        To understand why you see the differences, I would really suggest adding better visual confirmations when exactly your trade conditions are triggering, then you could expect an entry on the next bar open > the next possible trade execution location.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          I am not sure what you mean by visual confirmation. Isn't the buy and sell confirmation that's printed on the chart good enough? Please explain. Thank you

          Comment


            #6
            Correct, that would be the executions, however this would not be the same timing as the signal generation, as the signal will be processed / executed on bar after triggering. Thus if you add visual confirmation for example via Draw objects you would see both legs happening, the trigger and the execution.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Bertrand View Post
              With more advanced custom coding, a more realistic backtest results could be likely achieved by submitting your orders to a finer granularity (for example a 1 tick series), here's a sample how this would be approached - http://www.ninjatrader.com/support/f...ead.php?t=6652
              When I build a strategy and run in live or in replay the long entries are always made at the top of the bar and exits are always at the bottom of the bar. But in backtesting everything is good. Will the code from the link you posted correct this?

              Comment


                #8
                If you use the techninque in the sample referenced and submit your orders to the bid / ask series (instead for the default 'last') this will be aligning better.

                We have enhancing and simplifying this area on our feedback list for our next major NT update and I've also added a vote / request on your behalf in.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  relogical,
                  found this thread http://www.ninjatrader.com/support/f...822#post293822 where the problem is discussed more deeply. maybe this helps to understand the "Renko" problem better BUT u won't find a solution there (at least at the time being) since you will get unusable backtest results OR have to waste a lot of your time in adding granularity (i. e. 50 to 100 ticks) which will take "undefinite" time for the backtesting which is also not acceptable.
                  I suggested to use the end of the current bar for execution (at least for Renkos) instead of the open of the next bar (which will result in a lot of errors and unusable backtest results). we will see how NT reacts to that. If they don't solve the issue u basically cannot use Renkos with the strategy analyzer imho.
                  firstbrain

                  Comment


                    #10
                    1 year later

                    Originally posted by NinjaTrader_Bertrand View Post
                    If you use the techninque in the sample referenced and submit your orders to the bid / ask series (instead for the default 'last') this will be aligning better.

                    We have enhancing and simplifying this area on our feedback list for our next major NT update and I've also added a vote / request on your behalf in.

                    Hi,

                    Is there any progress already made OR is it still required to add visual confirmation at Renko bars? Thanks.

                    Tina

                    Comment


                      #11
                      Tina, the info above is still current and this is an active enhancement request for our next major update.
                      BertrandNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Fitspressorest, Today, 01:38 PM
                      0 responses
                      2 views
                      0 likes
                      Last Post Fitspressorest  
                      Started by Jonker, Today, 01:19 PM
                      0 responses
                      2 views
                      0 likes
                      Last Post Jonker
                      by Jonker
                       
                      Started by futtrader, Today, 01:16 PM
                      0 responses
                      6 views
                      0 likes
                      Last Post futtrader  
                      Started by Segwin, 05-07-2018, 02:15 PM
                      14 responses
                      1,791 views
                      0 likes
                      Last Post aligator  
                      Started by Jimmyk, 01-26-2018, 05:19 AM
                      6 responses
                      844 views
                      0 likes
                      Last Post emuns
                      by emuns
                       
                      Working...
                      X