Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Back testing a strategy on multiple data series

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

    Back testing a strategy on multiple data series

    Hi,
    I am back testing a strategy on multiple data series.
    Primary data series: 150 tick
    Secondary data series: 1 tick
    I am generating all my entry signals in 150 tick data series and executing them as market orders in 1 tick data series. Can you please conform the below order of execution steps are correct or not and correct me if I am wrong.
    Example: current testing tick: 150
    I have all the code written in OnBarUpdate method in the below order.
    1. BarsInProgress =0, will generate the entry signal (current tick 150, 150th tick last price is 1390)
    2. BarsInProgress =2, will issue a EnterLong() market order(current tick 150, 150th tick last price is 1390)
    Will this order gets filled @ 150 tick with the price 1390 or will it get filled @ 151 ticks last price @1390.25?
    In the initialize method I have Slippage=1; and also set the slippage to 1 in back testing properties.
    When I verified my results looks like slippage is not applied to the results.
    How do I make use of slippage property in this strategy modal with market orders?
    Thanks,
    gsreddy

    #2
    gsreddy, thanks for the post - do you use a third series here in this strategy as you're mentioning BarsInProgress = 2? This would be the second added series then, as the indexing works zero based. So your charted primary series is always BarsInProgress 0

    Slippage would be directly applied to the execution prices reported for market orders (doesnt apply to limit orders) - so you would need to compare executions generated with no Slippage vs Slippage set to your one tick.

    If you wish to send your orders to the added series, just do so from the primary BarsInProgress by spec'ed the BarsInProgress parameter to use in the advanced overload call for EnterLong()

    EnterLong(int barsInProgressIndex, int quantity, string signalName)

    Comment


      #3
      Hi,

      I have only two data series, baresinprogress=1 is my 1tick data used only for order execution,
      I have tried with and with out slippage, but the results are same.
      My code goes like below for entry and exit once I calculate entry direction, entry price, exit price(PT), stop price in chart data series (BarsInProgress == 0).
      if(BarsInProgress == 1)
      {
      if(goLong ==1) // to open long market position on tick data series
      {
      if(Closes[1][0] <= entryPrice )
      {
      goLong=0;
      longOrder1=EnterLong(1,qty,"L1");
      }
      }

      //exit long pos with Profit
      if(Closes[1][0] >= exitPrice && longOrder1 != null
      {
      longOrder1=null;
      goLong=0;
      ExitLong(1,Position.Quantity,"LP","L1");
      }
      //exit long pos with stop
      if(Closes[1][0] <= stopPrice && longOrder1 != null)
      {
      longOrder1=null;
      goLong=0;
      ExitLong(1,Position.Quantity,"LS","L1");
      }
      }
      Thanks,
      gsreddy

      Comment


        #4
        Thanks, the reason likely is that you already execute now to 1 tick series and a slippage beyond the bar extremes would not be supported. Since a 1 tick is bar here that's as close to simulating this as you could get. If you test for example the SampleMACrossOver we ship on a 100 Tick series with different slippage sets, it should be reported different results to show this factored in.

        If you want to account for extra penalty slippage in your testing, just add higher RT commission in for the script.

        Comment


          #5
          Hi,
          thanks for the clarification.
          can you please answer my question related to order execution tick(150 0r 151 in the below example)?

          thanks
          gsreddy

          Comment


            #6
            Sure, sorry - if you are in the next OnBarUpdate(), so your one tick series call after the closed bar on the 150 you are already on the next tick, so the opening tick of the next 150 T bar. If you send the order then on the 1 tick, it would execute the tick after as orders are always placed for the next bar in backtesting.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            93 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            48 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            31 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            34 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            69 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X