• 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

COBC = true - immediate action

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

    COBC = true - immediate action

    Hello,

    I need to use COBC == true in my scripts.

    How can I do then an immediate entry please? With "if...flat" in onbarupdate will do the entry at close of bar, in onExecution there will not be the entry I assume.

    How to do or where to set please for doing an immediate entry with COBC=true.

    Thanks
    Tony

    #2
    Hello Tony,

    If you would like to keep COBC on true, then you may want to use another method to be able to accomplish this like OnMarketData().

    For example:
    Code:
    #region Variables
              private bool once = true;
    #endregion
    protected override void OnMarketData(MarketDataEventArgs e)
    {
             if (once)
             {
                   EnterLong();
             }
             once = false;
    }
    Last edited by NinjaTrader_JC; 09-20-2013, 09:42 AM.
    JCNinjaTrader Customer Service

    Comment


      #3
      Hello JC,

      thank you very much for your support.

      The question occurs because I have issues when working with COBC=false when I want to have an entry at the close of a reversal bar. Can you please shortly tell me what is wrong here? Thank you!

      if (FirstTickOfBar && Close[2] < High[2] && Close[1] >= Open[1] && Close[1] > Low[1]
      && Position.MarketPosition == MarketPosition.Flat)

      {EnterLong();}

      Thank you!
      Tony

      Originally posted by NinjaTrader_JC View Post
      Hello Tony,

      If you would like to keep COBC on true, then you may want to use another method to be able to accomplish like OnMarketData().

      For example:
      Code:
      #region Variables
                private bool once = true;
      #endregion
      protected override void OnMarketData(MarketDataEventArgs e)
      {
               if (once)
               {
                     EnterLong();
               }
               once = false;
      }

      Comment


        #4
        Hello Tony,

        Could you clarify what issues that you are running into?
        JCNinjaTrader Customer Service

        Comment


          #5
          Oh, sorry,

          the issue is that there is an entry even when the bar is not closed.

          Thanks
          Tony



          Originally posted by NinjaTrader_JC View Post
          Hello Tony,

          Could you clarify what issues that you are running into?

          Comment


            #6
            Hi Tony,

            I added this code to a script and tested this a few times and was not able to reproduce the issue of the entry happening intra-bar.

            The check for FirstTickOfBar should ensure that the entry happens when the previous bar closes.

            Are you able to reproduce this consistently? Could you take a video of this happening?

            Below is a link to a website where you can obtain free software to create this video.
            http://www.techsmith.com/jing.html
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea,

              thank you for your support. I found out the problem - it was an error on my end. Because of working with different dataseries there was confusion with BarsInProgress.

              But with our conversation what I found out now is that when one wants to trade a reversal bar with COBC = false one needs to work with Close[2]<Open[2] and Close[1]>Open[1] and FirstTickOfBar. But with COBC== true one need to work with Close[1]<Open[1] and Close[0]>Open[0]. Correct?

              Thank you for all your support!

              Best
              Tony

              Originally posted by NinjaTrader_ChelseaB View Post
              Hi Tony,

              I added this code to a script and tested this a few times and was not able to reproduce the issue of the entry happening intra-bar.

              The check for FirstTickOfBar should ensure that the entry happens when the previous bar closes.

              Are you able to reproduce this consistently? Could you take a video of this happening?

              Below is a link to a website where you can obtain free software to create this video.
              http://www.techsmith.com/jing.html

              Comment


                #8
                Tony,

                Correct, you will need to adjust the Close and Open bars index for when you are using COBC = true.
                Cal H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by rickyblah12, Today, 01:01 PM
                0 responses
                6 views
                0 likes
                Last Post rickyblah12  
                Started by dadarara, Today, 12:18 PM
                0 responses
                7 views
                0 likes
                Last Post dadarara  
                Started by joemiller, Today, 07:33 AM
                0 responses
                8 views
                0 likes
                Last Post joemiller  
                Started by TheGameOfProbabilities, 07-18-2019, 06:56 AM
                7 responses
                37 views
                0 likes
                Last Post DaveS
                by DaveS
                 
                Started by claxxical, Yesterday, 10:00 PM
                0 responses
                11 views
                0 likes
                Last Post claxxical  
                Working...
                X