Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting an indicator to COBC = false from a strategy

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

    Setting an indicator to COBC = false from a strategy

    Hi,

    Is there a way to force an indicator from a strategy to not calculate on bar close?

    I have a multi time frame strategy with 1min bars for entry and 1 tick bars for exit.
    I would like it to exit when the DI+ or DI- plot from the DM indicator is greater than some value.

    Currently I can read the values each tick when BarsInProgress == 1 (that's my 1 tick bars) using
    Code:
    DM(BarsArray[0],14).DiPlus[0]
    (BarsArray 0 is the 1 minute chart)

    But since the DM indicator defaults to COBC = true the values I get every tick are not updated for that tick. I've tried calling the Update function of the indicator but that does not work either.

    Could you please point me in the right direction?
    Cheers!

    #2
    Hello dpicon,
    If you set the CalculateOnBarClose (COBC) property of the strategy to false then the indicator's COBC property will be also set as false.
    • Right click on the chart
    • In the context menu click on Strategies...
    • In the Strategies dialog select the strategy and click on the New button
    • In the parameter box on the right set the Calculate on bar close to false


    Please let me know if I can assist you any further.
    Attached Files
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Unfortunately that will break all my strategy code, as I will need to calculate things on FirstTickOfBar, and change references to Close[1] instead of Close[0], etc..

      Besides, that will make all indicators to COBC = false which might not be very optimal.

      Any other way around?

      As you already know from the other thread were you helped me a lot (Thanks!)
      I'm using a 1 tick bar data-series to emulate the COBC = false for my exits.
      With that system I change the less amount of code of my already proven strategy and I'll have less problems when doing backtesting later, or so I've read...

      Comment


        #4
        Hello dpicon,
        Unfortunately the indicators COBC will take queue from the strategies COBC only.

        If you need to calculate on the FirstTickOfBar, and still need to update the strategy tick by tick then you can refer to this sample code which demonstrates on such lines


        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          How would I be able to backtest my strategy with the COBC = false?

          I thought the only way to backtest something close to COBC = false was to have a smaller time frame like in this example: http://www.ninjatrader.com/support/f...ead.php?t=6652

          Which is what I'm doing in my strategy, but I need some indicators to recalculate every tick, not every minute.

          Maybe I've just missed a point here??

          Comment


            #6
            Hello dpicon,
            Unfortunately during backtesting the values will be evaluated at the end of the bars only (i.e. Calculate on bar close = true).

            Intrabar granulation is a workaround for order submission and not for calculating the indicator values.

            I will however send your feature request to development for future consideration.

            Please let me know if I can assist you any further.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              So if I want to be able to do backtesting I need COBC = true, and if I need real time indicators I need COBC = false.....

              Ok, I'll have a look and see if I can hack a way around:

              The only way I can think of now, is to recode some of the indicators to accept a parameter that forces them to Update using the 1 min DataSeries instead of the 1 tick dataseries even if they "belong" to the 1 tick time frame...

              Comment


                #8
                Hello dpicon,
                Development has assigned tracker id #688 for your feature request.

                Please let me know if I can assist you any further.
                JoydeepNinjaTrader Customer Service

                Comment


                  #9
                  Thanks!

                  Although I haven't yet look in depth into it, my first impressions are that I can achieve the desired result by attaching a smaller time-frame chart to the strategy (ie. 1 tick chart). Then I'd need to force the update of the 1min chart indicators with the new 1min OHLC calculated using the 1tick update.

                  Can you point me to a simple way of doing this, or I would need to modify all the indicators to use a custom OHLC data?

                  Comment


                    #10
                    Hello dpicon,
                    What you have suggested is workaround to submit orders (particularly during backtest). Please refer to this thread to know more http://ninjatrader.com/support/forum...ead.php?t=6652

                    However the indicators (calculated based on the one minute bar/lower granularity bars) will still be calculated a bar late.
                    JoydeepNinjaTrader Customer Service

                    Comment


                      #11
                      Well actually what I'm suggesting is to modify the inners of every indicator to use my custom set of OHLC values while we are intrabar. This way I would have COBC = false indicator in a COBC = true strategy.

                      Comment


                        #12
                        Hello dpicon,
                        Unfortunately that is not possible.

                        The only working alternative is to separate the logic in the FirstTickOfBar which is shown in this reference sample
                        JoydeepNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by usazencort, Today, 01:16 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post usazencort  
                        Started by kaywai, 09-01-2023, 08:44 PM
                        5 responses
                        603 views
                        0 likes
                        Last Post NinjaTrader_Jason  
                        Started by xiinteractive, 04-09-2024, 08:08 AM
                        6 responses
                        22 views
                        0 likes
                        Last Post xiinteractive  
                        Started by Pattontje, Yesterday, 02:10 PM
                        2 responses
                        21 views
                        0 likes
                        Last Post Pattontje  
                        Started by flybuzz, 04-21-2024, 04:07 PM
                        17 responses
                        230 views
                        0 likes
                        Last Post TradingLoss  
                        Working...
                        X