Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to force getting filled orders in simulation, in daily bars with OBC = false

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

    How to force getting filled orders in simulation, in daily bars with OBC = false

    Hi NT,

    This should be simple but not used to deal with daily data.
    I have a strategy that works with daily data but with real-time data for the last bar ( while building ) cause I set OnBarClose = False. I want to submit orders if a certain intraday condition is met, the problem is that whenever I run the simulation ( Strategy with live broker data and Sim101 ) those detected triggers for the historical data, submit the right orders but at the bar ending, so the real fill is complete in the next bar. I thought to use "If historical...return" but I need the historical data for certain calculations.
    The Strategy in real time seems to be fine, so my goal is: how to use historical data for calculations while ignore all historical orders but the recent one.

    So, I like to listen to any suggestions, workaround or direct commands that address the problem.
    Thanks

    EDIT
    I forgot to say that I was using Limit orders ( with broad prices ), but now that I'm trying market orders it seems to work better.
    Since IB is always notifying when you use "Market orders", I try always to use limit orders as long I can. Now I was trying to use Limit orders but using GetcurrentBid() and GetcurrentAsk() to submit orders almost like market, but the behavior is not the same, several historical orders remain unfilled. This happens when the Next day Bar has a gap and the simulator can match the limit order price to the open of new bar.

    SOLUTION
    What I did is to use " if (Historical) return" before submitting orders, so just allows real-time new orders. It seems to work but still checking
    Last edited by pstrusi; 06-26-2019, 08:46 AM.

    #2
    Hello pstrusi,

    Thanks for your post.

    So I understand correctly, you want to submit orders intrabar, and you also want them filled intrabar.

    To submit orders intrabar, you can have the strategy use a smaller data series or have a smaller data series added (Multi Time Frame Strategy.) This will work for both historical and realtime data when CalculateOnBarClose=false will only work for realtime data.

    To have the historical orders filled with intrabar granularity, you will have to submit the orders to a single tick data series.

    I have included information on Multi Time Frame strategies and for backtesting with intrabar granularity.

    Multi Time Frame and Instruments - https://ninjatrader.com/support/help...nstruments.htm

    Backtesting with Intrabar Granularity - https://ninjatrader.com/support/help...ipt_strate.htm

    Please let us know if we can be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim

      You can submit orders intrabar, without using smaller data series added (Multi Time Frame Strategy.) . The Solution that I've found is simply to allows just real time orders and rejected all historical orders.

      Regards

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by wzgy0920, 04-20-2024, 06:09 PM
      2 responses
      26 views
      0 likes
      Last Post wzgy0920  
      Started by wzgy0920, 02-22-2024, 01:11 AM
      5 responses
      32 views
      0 likes
      Last Post wzgy0920  
      Started by wzgy0920, Yesterday, 09:53 PM
      2 responses
      49 views
      0 likes
      Last Post wzgy0920  
      Started by Kensonprib, 04-28-2021, 10:11 AM
      5 responses
      192 views
      0 likes
      Last Post Hasadafa  
      Started by GussJ, 03-04-2020, 03:11 PM
      11 responses
      3,234 views
      0 likes
      Last Post xiinteractive  
      Working...
      X