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

Multiple Data Series and Fill Resolution

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

    Multiple Data Series and Fill Resolution

    Hello,

    I have a strategy that has 3 timeframes (i.e. AddDataSeries) and has trade logic on the Shortest and Medium timeframes. All Bars Objects are on the same instrument.

    for instance:
    BaseChart--> Shortest Timeframe: 500 Tick .. BarsArray[0]
    AddDataSeries --> Medium Timeframe: 2500 Tick .. BarsArray[1]
    AddDataSeries --> Longer Timeframe: 25000 Tick .. BarsArray[2]

    I am using OnExecutionUpdate() to monitor the trades and place ExitLongStopMarket and ExitShortStopMarket orders. The first iteration sends orders to the BarsArray the order was generated. Therefore, I would look at the BarsInProgress variable when inside of OnExecutionUpdate() to determine where to get the Stop price from. This worked correctly.

    Now when backtesting my fill resolution was poor. So I added another 1 Tick DataSeries, BarsArray[3]. Then inside of OnBarsUpdate() I would simply return when BarsInProgress == 3 as in
    Code:
                //Do Not process the Granular Resolution BarsArray used to submit Orders
                if (BarsInProgress == 3)
                    return;
    Changed the EntryOrders to send the orders to this 1Tick Bars Object with EnterLong(3, etc).

    The problem is that when I am in the OnExecutionUpdate() the BarsInProgress always is always 0 (BarsInProgress == 0). Why is it not == 3 ??

    Second Question:
    When Strategy is trading live is it correct that there is no benefit to sending Orders to a 1 Tick Bars Object and therefore should not be in a live Strategy ?

    Third Question:
    When using the Market Replay connection is there any order Fill improvement in accuracy when using the 1 Tick Bars Object?

    Fourth Question:
    Does the order that each BarsArray get loaded affect the Fill Resolution? For instance, I have the BarsArray[0] (ex: 500 Tick) sending Orders to BarsArray[3] (1 Tick) and BarsArray[1] (2500 Tick) sending Orders to BarsArray[3] (1 Tick) and the BarsArray[2] (25000 Tick) is just used for Filtering Indicators.

    Thanks,
    ATC
    Last edited by tornadoatc; 05-01-2020, 08:07 AM.

    #2
    Hello tornadoatc,

    Thanks for your post.

    The problem is that when I am in the OnExecutionUpdate() the BarsInProgress always is always 0 (BarsInProgress == 0). Why is it not == 3 ??
    OnExecutionUpdate is related to execution events when BarsInProgress is related to data processing events. I would not suggest checking BarsInProgress in OnExecutionUpdate, but I would still advise to submit orders to the single tick data series from OnExecutionUpdate (or wherever order methods are used.)

    When Strategy is trading live is it correct that there is no benefit to sending Orders to a 1 Tick Bars Object and therefore should not be in a live Strategy ?
    There would not be a difference in behavior with realtime order fill simulations since the realtime order fill simulation will use live bid/ask/volume to simulate trades instead of the data series that the order is submitted to. Submitting orders to a single tick data series makes historical fill simulations closer to market dynamics since it adds intrabar granularity for the fill series.

    When using the Market Replay connection is there any order Fill improvement in accuracy when using the 1 Tick Bars Object?
    Market Replay mimics realtime data. After you hit Play, orders will be filled following realtime fill simulations like submitting orders to the Sim101 account.

    Does the order that each BarsArray get loaded affect the Fill Resolution? For instance, I have the BarsArray[0] (ex: 500 Tick) sending Orders to BarsArray[3] (1 Tick) and BarsArray[1] (2500 Tick) sending Orders to BarsArray[3] (1 Tick) and the BarsArray[2] (25000 Tick) is just used for Filtering Indicators.
    The order in which the data series get loaded does not matter. As long as the order is getting submitted to a single tick data series, we will get historical fills that use intrabar granularity.

    For the thread's reference I have provided links to the differences between realtime and backtesting and I have also linked our Backtesting with intrabar granularity example.

    Discrepancies between realtime and backtest - https://ninjatrader.com/support/help...ime_vs_bac.htm

    Backtesting with intrabar granularity - https://ninjatrader.com/support/help...ipt_strate.htm

    We look forward to assisting.

    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    18 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    1 view
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    6 views
    0 likes
    Last Post Javierw.ok  
    Started by timmbbo, Today, 08:59 AM
    2 responses
    10 views
    0 likes
    Last Post bltdavid  
    Started by alifarahani, Today, 09:40 AM
    6 responses
    41 views
    0 likes
    Last Post alifarahani  
    Working...
    X