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

Benefit Of Purchasing Tick Data And Backtesting

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

    Benefit Of Purchasing Tick Data And Backtesting

    Hi,

    Using the Strategy Wizard all backtests are based on "Calculate On Bar Close". Unless I am missing something this seems to result in some real issues with reliability of the back test. When I do realtime testing I am getting order rejections with comments like "cannot have limit price smaller than current bid" when all I am doing is trying to sell at the high of the previous bar.. very frustrating and still not entirely sure why the system doesn't then sell "at market" seeing as the current bid is a better price than the limit price it tried to sell at.

    If I were to pay for historical tick data would this solve the issue and get the backtest to incorporate all of these situations?

    It was very frustrating to build a system that was robust and profitable based on backtesting and then find in realtime the strategy wouldn't execute.

    I might add this was based on an FOREX system, again if a Futures system would be better i'm happy to go that route

    Thanks

    #2
    Hi Tom,

    ' .... and still not entirely sure why the system doesn't then sell "at market" seeing as the current bid is a better price than the limit price it tried to sell at.'

    The reason here is that in FX generally marketable limits would not be allowed, as you have seen running into the rejection from your broker trying to place this order. Futures in contrast would allow it.

    So this would not be a matter of the COBC setting used.

    Generally for backtesting we expect to see discrepancies comparing to realtime results, the most common items are summarized here - https://www.ninjatrader.com/support/...ime_vs_bac.htm

    Adding tick data into the script would allow for simulating getting intrabar fills, which would likely make your backtest more accurate. However it would still be a backtest only and of course realtime results could deviate as market dynamics change going forward.

    Our next major platform update will allow per default to simulate fills with a finer resolution internally without the need to explicitly code this part in.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      Thanks, thats very informative.

      So it seems that I don't need to throw the system out for having unreliable fills, it is just a function of Forex trading that a limit order won't turn into a market order if the price has risen through the order value? I can try running this system on a futures contract.

      In terms of reliability of backtest of course there will always be some discrepancies my backtest includes slippage and default fill parameters (so has to trade through that price for a limit order). Anything else you can think of?

      Comment


        #4
        Correct, in FX there would generally not be marketable limit orders.

        If you include enough slippage that's important in FX, since here the bid price is normally used to chart the data and as such the typical bid / ask spread would not be considered when executing in backtest.

        Another item would be the CalculateOnBarClose setting and how your strategy / indicator would manage setting this to false, as it could generate whipsaw actions as your conditions become true and false again intrabar. Best is if you plan to use false for realtime trading, to give the script a run in MarketReplay to verify.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thats great thanks.

          I can understand how by turning off COBC would lead to trades being proven valid or invalid several times during one bar and wouldnt be wise to have.

          However, I have noticed in the backtest I have to use the term High[0] to reference the previous bar's high. Would this script still be true in a realtime test provided COBC is still set to true?

          Many thanks

          Comment


            #6
            A script run with COBC = true will run the same in historical as it will live there is no differences to the behavior you would expect. You only see the difference as you set the strategy to COBC = false and run the strategy live which then needed to be accounted for using coding practices that would only signal once per bar if thats all you wanted.

            Let me know if you have any further questions or anything I could verify for you.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by llanqui, Today, 03:53 AM
            0 responses
            6 views
            0 likes
            Last Post llanqui
            by llanqui
             
            Started by burtoninlondon, Today, 12:38 AM
            0 responses
            10 views
            0 likes
            Last Post burtoninlondon  
            Started by AaronKoRn, Yesterday, 09:49 PM
            0 responses
            15 views
            0 likes
            Last Post AaronKoRn  
            Started by carnitron, Yesterday, 08:42 PM
            0 responses
            11 views
            0 likes
            Last Post carnitron  
            Started by strategist007, Yesterday, 07:51 PM
            0 responses
            14 views
            0 likes
            Last Post strategist007  
            Working...
            X