• 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

OnBarUpdate orders

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

    OnBarUpdate orders

    I would like to code a strategy if an indicator reaches a value, to execute my order.
    So for example, if the RSI reaches 70 I want the order execution, and not after the bar close.

    I set: CalculateOnBarClose = false

    if (RSI (3,1)[0] > 70)

    {
    ExitLong("EinstiegLong", "");
    }

    But while I am backtesting the strategy the order execution is only after the bar close and not immediately after the RSI is at 70.

    Thank you.
    Last edited by Ironman9973; 11-03-2012, 04:26 AM.

    #2
    "When indicators or strategies are running on historical data, OnBarUpdate() is only called on the close of each historical bar even if this property is set to false. This is due to the fact that with a historical data set, only the OHLCVT of the bar is known and not each tick that made up the bar."

    A direct quote from Help menu, not sure if it helps to solve your problem

    Comment


      #3
      Hello,

      If you'd like to execute the orders immediately when backtesting, you will need to Add() a finer data series to execute on. Please see our Reference Sample on Backtesting NinjaScript Strategies with an intrabar granularity:

      http://www.ninjatrader.com/support/f...ead.php?t=6652
      MatthewNinjaTrader Product Management

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by jtrading82, Today, 04:05 PM
      0 responses
      1 view
      0 likes
      Last Post jtrading82  
      Started by ArmKnuckle, Today, 03:08 PM
      2 responses
      15 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by WeyldFalcon, Today, 06:13 AM
      0 responses
      14 views
      0 likes
      Last Post WeyldFalcon  
      Started by Stefan1982, Today, 09:26 AM
      1 response
      15 views
      0 likes
      Last Post NinjaTrader_Kate  
      Started by Mykro, Today, 02:51 PM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_BrendanC  
      Working...
      X