Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

COBC - time of trigger

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

    COBC - time of trigger

    Hello,

    I want to ask please if with COBC=true I can have an immediate entry long with

    GetCurrentAsk() > Close[1] (before close of current bar [0])

    Or what do I have to add for having the entry immediately when the condition is true.
    (with COBC=false there would be unnecessarily high CPU work I assume)

    Thank you
    Tony
    Last edited by tonynt; 10-24-2014, 03:54 AM. Reason: translation error

    #2
    Hi Tony, no you could not from OnBarUpdate with COBC = true. This setting to true means you only see the OnBarUpdate() call and thus your logic processed if the bar closed and a new one has been opened. You would need to run COBC = false to allow for intrabar logic to fire, you can for example skip out identical price ticks to look into minimizing the load.

    Another option would be sending the order from OnMarketData(), this method would be called for every Level 1 data update so triggered out of OnBarUpdate() context.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hello Bertrand,

      thank you for your reply.

      Is there an example how to do in OnMarketData instead of onbarupdate? Do I have to do everything, conditions and entries to onmarketdata?

      Thank you
      Tony


      Originally posted by NinjaTrader_Bertrand View Post
      Hi Tony, no you could not from OnBarUpdate with COBC = true. This setting to true means you only see the OnBarUpdate() call and thus your logic processed if the bar closed and a new one has been opened. You would need to run COBC = false to allow for intrabar logic to fire, you can for example skip out identical price ticks to look into minimizing the load.

      Another option would be sending the order from OnMarketData(), this method would be called for every Level 1 data update so triggered out of OnBarUpdate() context.

      Comment


        #4
        Hi Tony, no - most items would be just in OnBarUpdate(). However at some point you would look for an entry and that's when you would start monitoring the ask condition then in your OnMarketData() so you can work off the ask update event. I've attached a little example.
        Attached Files
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hello,

          when doing the condition in onmarketdata for having the entry before close of price-bar, what about the indicator. I need an entry with touch of Donchian, will the indicator "be there" when price-bar is COBCfalse?

          if (GetCurrentBid() = Instrument.MasterInstrument.Round2TickSize(Donchia nChannel(BarsArray[0],13).Upper[0])
          then goshort.

          Please see the attached screenshot. With "GetCurrentBid()..." would there be the entry at this DonchianUpper with the circle in the screenshot?

          And another question to understand onmarketdata please: with
          && BarsInProgress==2
          &&FirstTickOfBar
          && Highs[2] ==Instrument.MasterInstrument.Round2TickSize(Donch ianChannel(BarsArray[0],13).Upper[0])
          &&Closes[2][0] < Highs[2][0]
          can I have an entry with close of bar of added dataseries in onmarketdata?


          Thank you
          Tony
          Attached Files
          Last edited by tonynt; 06-09-2015, 06:55 AM. Reason: Translation Error, Clearifying

          Comment


            #6
            Hello tonynt,

            Thank you for your post.

            The Indicator would be able to calculate intra-bar with CalculateOnBarClose = False. So it would be able to see such occurrences as your screenshot.

            You would not be able to set an order to wait until the bar closes in OnMarketData(). You may wish to create a bool that is set to true when your condition is true in OnMarketData() and then check for this bool in OnBarUpdate() when CalculateOnBarClose = true.

            Please let me know if I may be of further assistance.

            Comment


              #7
              Hello,

              thank you for your reply.

              I understand the solution with bool in onmarketdata. (But please let me ask why to use a bool and not a variable? Thank you)

              But I do not understand how I can refer from a strategy to an indicator that way that the indicator is COBC=false. When adding an indicator to a chart I can set in the parameters COBC=false, this is clear of course. But when I use a script-strategy and in this strategy I use an indicator - how does the script "know" if this indicator is COBC=false or COBC=true?

              Thank you for your support.

              Tony

              Originally posted by NinjaTrader_PatrickH View Post
              Hello tonynt,

              Thank you for your post.

              The Indicator would be able to calculate intra-bar with CalculateOnBarClose = False. So it would be able to see such occurrences as your screenshot.

              You would not be able to set an order to wait until the bar closes in OnMarketData(). You may wish to create a bool that is set to true when your condition is true in OnMarketData() and then check for this bool in OnBarUpdate() when CalculateOnBarClose = true.

              Please let me know if I may be of further assistance.
              Last edited by tonynt; 06-09-2015, 11:07 AM. Reason: Translation Error

              Comment


                #8
                Hello tonynt,

                Thank you for your response.

                Unless you specifically set CalculateOnBarClose in the Indicator's code, the Indicator will use what the Strategy is set to for CalculateOnBarClose.

                So are you trying to run the Strategy as CalculateOnBarClose = True but the Indicator as CalculateOnBarClose = False?

                Comment


                  #9
                  Hello,

                  yes, this is what I´m trying to do because I assume COBC=false will be a problem for CPU with a lot of strategies.

                  You mean to add the indicator to the chart where I´m running the script and to set the indicator to COBC=false and then the strategy with COBC=true will use the DonchianCOBC=false to have the indicator that moment when I need it? There´s nothing to set within the script-strategy?

                  Thank you
                  Tony

                  Originally posted by NinjaTrader_PatrickH View Post
                  Hello tonynt,

                  Thank you for your response.

                  Unless you specifically set CalculateOnBarClose in the Indicator's code, the Indicator will use what the Strategy is set to for CalculateOnBarClose.

                  So are you trying to run the Strategy as CalculateOnBarClose = True but the Indicator as CalculateOnBarClose = False?
                  Last edited by tonynt; 06-09-2015, 01:51 PM. Reason: typing error

                  Comment


                    #10
                    Hello tonynt,

                    Thank you for your response.
                    You mean to add the indicator to the chart where I´m running the script and to set the indicator to COBC=false and then the strategy with COBC=true will use the DonchianCOBC=false to have the indicator that moment when I need it? There´s nothing to set within the script-strategy?
                    No, this would not perform in that manner.
                    You can set the Strategy to CalculateOnBarClose = False to force the Indicator to CalculateOnBarClose = False, then use FirstTickOfBar to simulate CalculateOnBarClose = True for your strategy conditions.
                    You can find information on using FirstTickOfBar to simulate CalculateOnBarClose = True at the following link: http://www.ninjatrader.com/support/f...ad.php?t=19387

                    Please let me know if I may be of further assistance.

                    Comment


                      #11
                      Hello Patrick,

                      please let me ask finally to be sure 100%.

                      When I have the condition

                      if (GetCurrentBid() = Instrument.MasterInstrument.Round2TickSize(Donchia nChannel(BarsArray[0],13).Upper[0])

                      in OnMarketData then I have the DonchianUpper Value only with close of bar when strategy is set to COBC=true?

                      Thank you
                      Tony

                      Comment


                        #12
                        Hello tonynt,

                        Thank you for your response.
                        in OnMarketData then I have the DonchianUpper Value only with close of bar when strategy is set to COBC=true?
                        OnMarketData() updates when market data updates, it does not update based on bar closes. So the answer here would be no.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by GLFX005, Today, 03:23 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post GLFX005
                        by GLFX005
                         
                        Started by XXtrader, Yesterday, 11:30 PM
                        2 responses
                        11 views
                        0 likes
                        Last Post XXtrader  
                        Started by Waxavi, Today, 02:10 AM
                        0 responses
                        6 views
                        0 likes
                        Last Post Waxavi
                        by Waxavi
                         
                        Started by TradeForge, Today, 02:09 AM
                        0 responses
                        12 views
                        0 likes
                        Last Post TradeForge  
                        Started by Waxavi, Today, 02:00 AM
                        0 responses
                        2 views
                        0 likes
                        Last Post Waxavi
                        by Waxavi
                         
                        Working...
                        X