Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

immediate execution on strategy analyzer

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

    immediate execution on strategy analyzer

    I have a strategy that I have an iintrabar alert to place entry order. however it fills only on the next bar. how can I fix it?

    #2
    Hello junkone,

    Thanks for opening the thread.

    After taking debugging steps by adding prints to the strategy logic, can you confirm your entry and exit conditions in fact becoming true intra-bar?

    A common issue with intra bar strategies is that Calculate is not set to Calculate.OnEachTick and the strategy only operates on the close of each bar. This would cause orders to be filled on the next bar.

    Additionally, historical processing cannot be processed on each tick unless Tick Replay is used. If these are historical orders that are offset, you can apply a single tick data series and have the orders submit to the BarsInProgress of that data series to see historical intrabar fills. (If you would like more detail on Historical vs. Realtime data please see here.)

    I'll include a link to sample that describes backtesting with intrabar granularity. I encourage you to check it out while testing and developing your strategy.

    I've included some publicly available documentation on the items discussed, and tips for debugging your strategy and using Trace Orders.

    Debugging - https://ninjatrader.com/support/foru...ead.php?t=3418

    TraceOrders - https://ninjatrader.com/support/foru...ead.php?t=3627

    Calculate - https://ninjatrader.com/support/help...?calculate.htm

    MultiSeries NinjaScripts (Important read for intrabar granularity) - https://ninjatrader.com/support/help...nstruments.htm

    Backtesting with Intrabar granularity - https://ninjatrader.com/support/foru...ead.php?t=6652

    Please let me know if I may be of further assistance or if you have any additional questions.
    JimNinjaTrader Customer Service

    Comment


      #3
      I am connected to dtniq and I am using the Calculate = on each tick.
      I am using the strategy analyzer and its only dealing with the signals at end of the bar.

      if (State == State.SetDefaults)
      {
      Description = @"Enter the description for your new custom Strategy here.";
      Name = "PullbackandBreakout";
      Calculate = Calculate.OnEachTick;
      EntriesPerDirection = 1;
      EntryHandling = EntryHandling.AllEntries;
      IsExitOnSessionCloseStrategy = true;
      ExitOnSessionCloseSeconds = 30;
      IsFillLimitOnTouch = false;
      MaximumBarsLookBack = MaximumBarsLookBack.Infinite;
      OrderFillResolution = OrderFillResolution.Standard;
      Slippage = 0;
      StartBehavior = StartBehavior.WaitUntilFlat;
      TimeInForce = TimeInForce.Gtc;

      RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
      StopTargetHandling = StopTargetHandling.PerEntryExecution;
      BarsRequiredToTrade = 201;
      // Disable this property for performance gains in Strategy Analyzer optimizations
      // See the Help Guide for additional information
      IsInstantiatedOnEachOptimizationIteration = true;
      LargeMA = 200;
      MediumMA = 50;
      LargeRange = 7;
      TraceOrders = true;
      }

      Comment


        #4
        Hello junkone,

        The Strategy Analyzer uses historical OHLC values of the data series to simulate order fills. Orders would be expected to fill on the next bar unless you are using High Order Fill Resolution or if you are submitting orders to a single tick data series. Also, the strategy will not operate Calculate.OnEachTick since backtesting in the Strategy Analyzer is a form of historical processing. Tick Replay would need to be used in such a case.

        If you test using Market Replay data in the Playback Connection, the strategy will think it is running on realtime data and will operate with Calculate.OnEachTick. If you are still seeing unintended behavior in the strategy when testing with the Playback Connection, I would then suggest to add debugging prints to the strategy to monitor the logic as it executes.

        Have you taken debugging steps to verify that the strategy is submitting orders within that bar?

        I've included documentation on using the Playback Connection for the thread's reference.

        Playback Connection - https://ninjatrader.com/support/help...s/set_up12.htm

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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by AlexsOptions, Today, 05:42 PM
        1 response
        6 views
        0 likes
        Last Post bltdavid  
        Started by philli4093, Today, 05:20 PM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_ShawnB  
        Started by memonolog, Today, 04:58 PM
        0 responses
        1 view
        0 likes
        Last Post memonolog  
        Started by robvul, Today, 04:20 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_ShawnB  
        Started by sandman, Today, 01:54 PM
        3 responses
        23 views
        0 likes
        Last Post NinjaTrader_Jim  
        Working...
        X