• 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

CalculateOnBarClose question

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

    CalculateOnBarClose question

    hi, is there a way that i can set CalculateOnBarClose = false, so i can monitor real time tick data (say, last traded price > entered price then i take profit) while for the indicators, it only fires when CalculateOnBarClose = true ? i mean, say, i want the RSI(14) calculated once every 5 minutes (5-min-bar)

    Is there a way to do that? Thanks

    #2
    Yes Lawrence, you can combine settings as needed with the concept shown in our reference sample on this topic below -

    http://www.ninjatrader.com/support/f...ad.php?t=19387
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand,

      That trade strategy example really doesn't address the problem very well for two reasons.

      - Trade logic for the entry ( EnterLong() ) trigger is FirstTickOfBar, while exit ( ExitLong() ) trigger is every tick.
      - The trade strategy uses Add() to add two indicators to the chart which update with each tick, so unnecessary CPU resources would be taking place to update the chart with each tick even though the trade logic does not require this.

      An alternate to using 'CalculateOnBarClose = true' option, would be to use a look back or the BarsAgo parameter [1]. That way, the calculation result would be the same as a calculation immediately on bar close or with the final tick of the bar.

      Do you have any other examples that would work to conserve CPU resourses for multi-timeframe computations that use added timeframes with CalculateOnBarClose = false, but still allow some intrabar computations for some portion of the entry and exit trade logic? If not, how might one approach this in C# or Ninjascript?

      Comment


        #4
        Hello,

        You do not have to have the Add() call. That is just for show to display the indicator in the chart.

        You could remove the Add() and then manually add the indicator to the chart with COBC = true.

        Furthermore, with just 2 or more indicators cobc = false usually is no problem.

        -Brett
        BrettNinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_Brett View Post
          Hello,

          You do not have to have the Add() call. That is just for show to display the indicator in the chart.

          You could remove the Add() and then manually add the indicator to the chart with COBC = true.

          Furthermore, with just 2 or more indicators cobc = false usually is no problem.

          -Brett
          Brett,

          Regardless of how one adds the indicator to the chart, the indicator will update intrabar with each tick, thus wasting CPU processing ability.

          This is not generally a problem with simple strategies, however with fully developed strategies, it is a serious problem. If it wasn't a problem, COBC=true option would never have been added to the Ninjascript reference library, because as I pointed out in my earlier post, one could just use the barsAgo parameter [1].

          Do you have any other examples that would work to conserve CPU resourses for multi-timeframe computations that use added timeframes with CalculateOnBarClose = false, but still allow some intrabar computations for some portion of the entry and exit trade logic? If not, how might one approach this in C# or Ninjascript?
          Last edited by borland; 05-02-2012, 03:36 PM.

          Comment


            #6
            borland, we would unfortunately have no other optimizing examples available - if you need an intrabar updated indicator then you would need to run this portion of code COBC = false or introduce a timer for example that could help reduce OBU cycles. Yet another approach could be to filter out OBU's triggered by the same price being seen, this would be a good solution for price driven strategies / indicators.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by dtl-saw, Today, 03:36 PM
            0 responses
            3 views
            0 likes
            Last Post dtl-saw
            by dtl-saw
             
            Started by williamzz, Today, 02:04 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Started by jtrading82, Today, 01:55 PM
            3 responses
            21 views
            0 likes
            Last Post NinjaTrader_Tyler  
            Started by StevenNelson, Today, 01:00 PM
            4 responses
            19 views
            0 likes
            Last Post StevenNelson  
            Started by allinthechart, Today, 12:21 PM
            0 responses
            8 views
            0 likes
            Last Post allinthechart  
            Working...
            X