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 mattbsea, Today, 05:44 PM
      0 responses
      3 views
      0 likes
      Last Post mattbsea  
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      31 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by tkaboris, Today, 05:13 PM
      0 responses
      2 views
      0 likes
      Last Post tkaboris  
      Started by GussJ, 03-04-2020, 03:11 PM
      16 responses
      3,282 views
      0 likes
      Last Post Leafcutter  
      Started by WHICKED, Today, 12:45 PM
      2 responses
      20 views
      0 likes
      Last Post WHICKED
      by WHICKED
       
      Working...
      X