Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entries Exits Dual TimeFrames problem

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

    Entries Exits Dual TimeFrames problem

    Hi guys,
    I have a strategy with two bar series, both daily, with stocks loaded into them. The strategy requires measuring relative movement between the two stocks, so I have all my processing in BarsInProgress 1. If I use BIP 0, of course, the data I get from BIP 1 is not up to date yet.
    So far so good.
    When I take a position, I take it in both stocks at once, like this

    (... in BarsInProgress == 1)
    EnterShort(0,Inst0Quantity,EntryNameString);
    EnterLong(1,Inst1Quantity,EntryNameString);

    I expect the strategy to enter at the next day's Opening price.
    However, only the instrument in BarsInProgress 1 enters the next day. Instrument 0 takes an additional day to enter. Exits are similarly delayed on BIP 0.
    This is clearly not what I am after, so perhaps you can advise what might be going wrong.
    Here is data from the Output Window using TraceOrders...

    23-Feb-93 (BIP==1) Entry: Inst 0 Short 1761 shares, Inst 1 Long 842 shares.

    23-Feb-93 12:00:00 AM Entered internal PlaceOrder() method at 23-Feb-93 12:00:00 AM: Action=SellShort OrderType=Market Quantity=1,761 LimitPrice=0 StopPrice=0 SignalName='T1' FromEntrySignal=''
    23-Feb-93 12:00:00 AM Entered internal PlaceOrder() method at 23-Feb-93 12:00:00 AM: Action=Buy OrderType=Market Quantity=842 LimitPrice=0 StopPrice=0 SignalName='T1' FromEntrySignal=''

    Execution='NT-00000' Instrument='RIOTCT' Account='Sim101' Name='T1' Exchange=Default Price=11.88 Quantity=842 Market position=Long Commission=0 Order='NT-00001' Time='24-Feb-93 12:00:00 AM'
    Execution='NT-00001' Instrument='BHPTCT' Account='Sim101' Name='T1' Exchange=Default Price=5.67 Quantity=1,761 Market position=Short Commission=0 Order='NT-00000' Time='25-Feb-93 12:00:00 AM'

    As you can see, the TraceOrders of the Entries are the same date, 23-Feb. THE EXECUTIONS ARE DIFFERENT DAYS. This is not a stock data issue as it happens every time on every trade.

    Please help.
    Cheers,
    saltminer

    #2
    saltminer,

    This is what happens in backtesting. When you submit from BIP1 to BIP0, the message is received on the next bar which becomes the signal bar and then is filled on the following bar which is the trading bar.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      So the way Ninja is designed I have the choice of either...

      a) Calculating in BIP==0 which I can't because I don't yet have up-to-date data for BIP==1

      or

      b) Calculating in BIP==1 which I can't because orders are delayed a bar

      Correct?


      What about if I write my own filltype? Will BIP be available inside that processing? I could set BIP==0 to open on current day, not next day (I've already written logic like that successfully for something else one time, although it didn't try to access BIP.)

      stymied saltminer
      Last edited by saltminer; 04-30-2009, 06:55 PM. Reason: politeness

      Comment


        #4
        Saltminer, your best option for backtesting would be to add a finer stream for simulation of intrabar fills as explained in this sample - http://www.ninjatrader-support2.com/...ead.php?t=6652

        Comment


          #5
          Thanks, yes I get that concept, but I am backtesting over 15 years of daily data. I don't have any data finer in granularity than daily.

          I suppose I could add a third bar series that is the same as BIP[0], take the trade on that. At least then it will fire on time, even if I can't see it displayed on the chart.

          But back to another question... is BarsInProgress available inside the Fill processing code? I could modify a FillType if it is....
          Thanks.
          saltminer

          Comment


            #6
            saltminer,

            No, you work within one context at a time. I suggest you try and get additional granularity since that would be the preferred way to proceed.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            558 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            545 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X