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 Irukandji, Yesterday, 02:53 AM
                2 responses
                17 views
                0 likes
                Last Post Irukandji  
                Started by adeelshahzad, Today, 03:54 AM
                0 responses
                3 views
                0 likes
                Last Post adeelshahzad  
                Started by CortexZenUSA, Today, 12:53 AM
                0 responses
                3 views
                0 likes
                Last Post CortexZenUSA  
                Started by CortexZenUSA, Today, 12:46 AM
                0 responses
                1 view
                0 likes
                Last Post CortexZenUSA  
                Started by usazencortex, Today, 12:43 AM
                0 responses
                5 views
                0 likes
                Last Post usazencortex  
                Working...
                X