• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 ct, Today, 08:13 PM
      0 responses
      3 views
      0 likes
      Last Post ct
      by ct
       
      Started by Lumbeezl, Today, 05:17 PM
      0 responses
      6 views
      0 likes
      Last Post Lumbeezl  
      Started by wishing, Today, 03:33 PM
      0 responses
      10 views
      0 likes
      Last Post wishing
      by wishing
       
      Started by ATMtrader0001, Today, 01:48 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_PaulH  
      Started by RandanAL, Yesterday, 05:13 PM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_Kate  
      Working...
      X