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 chbruno, Today, 04:10 PM
          0 responses
          1 view
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          436 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          6 views
          0 likes
          Last Post FAQtrader  
          Started by rocketman7, Today, 09:41 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by frslvr, 04-11-2024, 07:26 AM
          9 responses
          127 views
          1 like
          Last Post caryc123  
          Working...
          X