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

Testing historical renko data with tick granularity – Solved.

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

    Testing historical renko data with tick granularity – Solved.

    We all know limitations of the Strategy Analyzer on historical data test. It is impossible to test reliably historical data, especially Renko charts. I Implemented an idea, allowing to test Renko bars with intrabar granularity. I implemented a trivial SMA crossover strategy as a feasibility check. An explanation follows:
    You must have a tick historical data.
    The primary data must be must a tick data, otherwise it's impossible to place an order with a tick precision, because Strategy Analyzer is capable to send order only on bar close (in this case a tick).
    I'm adding a renko data, as the secondary series (ticks2 input is my renko size).
    I'm adding tick ask and tick bid data, in order to enter long on ask and short on bid prices.
    I'm defining two data series: askTicks and bidTicks synchronized to renko bars. These two series imitate renko bars, but I'm updating the last bar of the series every tick, for asks and bids accordingly. Pay attention that on renko bar close, previous bar of ask and bid data series are updated. This way I have data series, which are identical to renko closes, except of current bar, updated every bid and ask tick accordingly. These series are used for a computation, in this example SMA crossover, which is updated every tick, but based on renko series. Once you'll run the strategy analyzer, you'll see that orders are issued not on renko close, but intrabar ticks, while renko is populated.


    It is possible to add two renko series separately, renko based on bid and renko based on ask, it may be even more precise.
    Of course, my idea will run on any historical data, but renko was most acute.
    Encl. Exported strategy and Strategy Analyzer setup screen. The analyzer must be run on 1-tick data. You may set exit on close according to your needs.
    Attached Files
    Last edited by xTrader1; 09-17-2014, 02:04 PM.

    #2
    Hello xTrader1,

    Thank you for your post and solution.

    I want to throw out a reminder in regards to the Historical Bid and Ask data.

    Note, that not all data providers have Historical Bid and Ask data available. Please check the link below on your data provider and what data is available -
    http://www.ninjatrader.com/support/h...rical_data.htm

    Additionally, please see the link below on Using Historical Bid/Ask Series in your strategy -
    http://www.ninjatrader.com/support/h..._ask_serie.htm
    Last edited by NinjaTrader_CalH; 09-17-2014, 02:41 PM.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Cal View Post
      Hello xTrader1,

      Additionally, please see the link below on Using Historical Bid/Ask Series in your strategy -
      http://www.ninjatrader.com/support/h..._ask_serie.htm
      Thanks. If you paid attention to my code, I'm using OnBarUpdate , not OnMarketData.
      I'm trading Forex, bid/ask is always available there. In case there is no bid/ask , the 1-tick close may be used, but than a spread must be estimated in the strategy.

      Comment


        #4
        Hello,

        Not wanting to intrude too much, but is this really necessary?
        Meaning : wouldnt a Add (PeriodType.Tick, 1); in the Initialize produce the same results? Not accounting for the spread.
        I only have tick data based on last and with the line above o get intrabar fills using renko bars.

        Thank you for providing a solution.

        Comment


          #5
          Originally posted by hliboi View Post
          Hello,

          Not wanting to intrude too much, but is this really necessary?
          Meaning : wouldnt a Add (PeriodType.Tick, 1); in the Initialize produce the same results? Not accounting for the spread.
          I only have tick data based on last and with the line above o get intrabar fills using renko bars.

          Thank you for providing a solution.
          With backtesting too?

          Comment


            #6
            Hello otislauwaert,

            Thank you for your response.

            If you have the historical Tick data then that would work for historical data as well. Please visit the following link for information on the data from your data provider: https://ninjatrader.com/support/help...y_provider.htm

            Please let me know if you have any questions.

            Comment


              #7
              Hello Patrick,

              I do have Historical Tick Data but whatever I do I can not seem to backtest with a Renko Bar Type that fills trades intrabar on Historical Data. See attached images where I am showing the differences after reloading the strategy. This is a problem for me because sometimes my strategy fills a trade on the wick of a Renko but that trade is not shown on historical data.
              Attached Files

              Comment


                #8
                Hello otislauwaert,

                Thank you for your response.

                Renko bars are not recommended for backtesting as the bar type re-draws it's open when you are viewing realtime data by nature of the bar type. However, on historical data the Renko bar type does not know each tick that built the bar and in what sequence therefore you can see discrepancies in backtesting Renko bars.

                Please let me know if you have any questions.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by philmg, Today, 01:17 PM
                0 responses
                2 views
                0 likes
                Last Post philmg
                by philmg
                 
                Started by cre8able, Today, 01:01 PM
                1 response
                4 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by manitshah915, Today, 12:59 PM
                1 response
                3 views
                0 likes
                Last Post NinjaTrader_Erick  
                Started by ursavent, Today, 12:54 PM
                1 response
                4 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by Mizzouman1, Today, 07:35 AM
                3 responses
                17 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Working...
                X