Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit condition that needs to be using COBC False but primary strategy is COBC True

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

    Exit condition that needs to be using COBC False but primary strategy is COBC True

    I am using COBC=True for primary bars. I have one of my exit conditions that I would like for it to individually exit me out with it beign COBC=False. How do I distinguish for that condition to use False instead of what the primary strategy is set to (in this case primary is set to True)?

    Sample code would be great if you could...anyone can weigh in...



    Greg

    #2
    Greg, you can check into this sample here for an idea - http://www.ninjatrader.com/support/f...ad.php?t=19387

    You would work with CalculateOnBarClose = false and check in FirstTickOfBar to simulate the 'true' effect.

    Comment


      #3
      I think the code you posted had a example of if the primary strategy was set to COBC False and what to do to separate logic to COBC True on a portion of it....

      What would you do for the opposite though?

      With the primary set to COBC True but you want to calculate part of the logic for a exit to COBC False?



      Greg

      Comment


        #4
        Hello,

        The opposite is not possible. You can have your whole strategy COBC = True OR False.

        You can then handle the strategy differently depending on your end goal.

        The example Bertrand linked shows you how to take a COBC = False strategy and only execute at the close of each bar.

        If you're strategy is COBC = true and you want to calculate intrabar you would need to use a smaller time frame to place the trades. Here is an example: http://www.ninjatrader.com/support/f...ead.php?t=6652

        The example adds a smaller TimeFrame to the larger primary. Some people prefer to have the smaller TF be the primary and add the larger. It's personal preference.
        LanceNinjaTrader Customer Service

        Comment


          #5
          Guys:

          Let me approach it a bit different...

          Thanks for the info...it helps some...but, here is what I need to do:

          1. I am entering in on 15 min PRIMARY bars.
          2. One of several of my exit conditions is this:

          Code:
          else if (Position.MarketPosition == MarketPosition.Short // TESTING Unrealized PnL Emergency Exit SHORT POSITION in case stop loss gets skipped, removed, or missed 
                              && Position.GetProfitLoss(Close[0], PerformanceUnit.Points) < -33)
                          {
                              Print ("UnP Emr Exit Short");
                              ExitShort("UnP Emr Exit Short", "");
                              // OFF Disable();
          Ok, this seems to only exit after a primary bar (in this case a 15 min bar) closes and if the condition is true it exits correct?

          However, I would like this exit to be in real time (not when the bar closes).

          How do I command it to do that?

          Please...others are also welcome to chime in......



          Greg
          Last edited by birdog; 03-07-2013, 03:26 PM.

          Comment


            #6
            Greg, you would then do your exit monitoring part in the finer added BarsInProgress, for example a 1 minute series or lower if you prefer. To get those updates CalculateOnBarClose would not have to be false, they would then also update end of bar, but of course in 1 minute intervals and not your primary 15 min so allowing for a quicker exit once the condition then triggers.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, Yesterday, 10:06 AM
            0 responses
            22 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            19 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            14 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            10 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            41 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X