Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Analysis on wrong bar

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

    Analysis on wrong bar

    I have a condition that is based on the close of bar1. When that happens "Plot0" is either 1 for "Buy" or -1 for "Sell" at the Open of bar2. When I run Strategy Analyzer it enters a Buy at Open of bar3. How do I get Stategy Analyzer to enter Buy at Open of bar2?

    this is code I have in Stategy Analyzer:

    myindicator(xxx,xxx,xxx)Plot0[0] >0

    #2
    velocity, unfortunately that is expected in backtesting. The Plot being greater than 0 is recognized on bar 2, so the order is placed on bar 3. To add finer granularity to your backtesting and achive intrabar fills, please see this sample - http://www.ninjatrader-support2.com/...ead.php?t=6652
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Velocity,

      The only way I have been able to get around the next bar execution is to reference the order to the current bar, not the indicator.

      Open[0], Close[0], etc.

      When I do this, I can enter and exit trades inside the current bar, depending on my strategy.

      Testing needs to be done with market replay. Not that !@#$&%# analyzer.

      I hope this helps,

      RJay
      Last edited by RJay; 07-22-2009, 05:54 AM.
      RJay
      NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

      Comment


        #4
        rt6176,

        Thanks for the reply. I am a little confused by what you are saying. can you elaborate?

        Comment


          #5
          Velocity,

          This code will execute trades in the same bar.

          ------------------------------------------------

          protectedoverridevoid Initialize()
          {
          CalculateOnBarClose = false;
          }
          ///<summary>
          /// Called on each bar update event (incoming tick)
          ///</summary>
          protectedoverridevoid OnBarUpdate()
          {
          // Condition set 1
          if (Close[0] > Open[0] + PlusBarRange * TickSize)
          {
          EnterLong(DefaultQuantity, "");
          }
          // Condition set 2
          if (Close[0] < Open[0] + MinusBarRange * TickSize)
          {
          EnterShort(DefaultQuantity, "");
          }
          }

          ------------------------------------------------

          If I reference an indicator, I believe it forces a first tick of new bar requirement.

          I yelled at NT but they didn't care. Maybe you could get them to listen.

          RJay
          RJay
          NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bmartz, Today, 09:30 AM
          2 responses
          11 views
          0 likes
          Last Post bltdavid  
          Started by f.saeidi, Today, 11:02 AM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by geotrades1, Today, 10:02 AM
          4 responses
          12 views
          0 likes
          Last Post geotrades1  
          Started by rajendrasubedi2023, Today, 09:50 AM
          3 responses
          16 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by lorem, Today, 09:18 AM
          2 responses
          11 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X