• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.
            Patrick H.NinjaTrader Customer Service

            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.
                Patrick H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by cocopod, Today, 04:47 PM
                0 responses
                2 views
                0 likes
                Last Post cocopod
                by cocopod
                 
                Started by digibob, Today, 02:47 AM
                2 responses
                13 views
                0 likes
                Last Post NinjaTrader_Kate  
                Started by mntemel, Today, 03:31 PM
                4 responses
                15 views
                0 likes
                Last Post mntemel
                by mntemel
                 
                Started by mrlucky1x, Today, 03:14 PM
                1 response
                3 views
                0 likes
                Last Post NinjaTrader_ChrisL  
                Started by ninjo, Today, 02:42 PM
                3 responses
                8 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X