Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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:

      You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by
      MatthewNinjaTrader Product Management

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by hazylizard, Today, 08:38 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by geddyisodin, Today, 05:20 AM
      2 responses
      16 views
      0 likes
      Last Post geddyisodin  
      Started by Max238, Today, 01:28 AM
      5 responses
      44 views
      0 likes
      Last Post Max238
      by Max238
       
      Started by giulyko00, Yesterday, 12:03 PM
      3 responses
      13 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by habeebft, Today, 07:27 AM
      1 response
      16 views
      0 likes
      Last Post NinjaTrader_ChristopherS  
      Working...
      X