Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calculate on bar close=FALSE (prevent immediate entry and begin on the next signal)?

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

    Calculate on bar close=FALSE (prevent immediate entry and begin on the next signal)?

    Hi:

    What do I need to do to tell NT (when using Calculate on bar close=FALSE) upon enabling a strategy to begin executing orders on the next signal and not immediately upon enabling? Right now, with setting it to FALSE it immediately gets me in a trade upon enabling.

    True waits of course...but I don't want False to get me in immediately upon enabling the strategy...only on the next valid signal and all other signals from that point onward.



    Greg

    #2
    Hi Greg, you could work with the WaitUntilFlat option - this would wait for the next realtime generated entry signal your code generates to start trading the script - http://www.ninjatrader.com/support/h...ub=Wait%2BFlat

    Comment


      #3
      bertrand...I have that on...but still enters immediately...please let me know...Greg

      Comment


        #4
        Originally posted by birdog View Post
        bertrand...I have that on...but still enters immediately...please let me know...Greg
        It sounds like you do not want the Strategy to enter on any bars before it is enabled. IOW, realtime trades only.

        Why not just use the Historical property then?

        Code:
        if (Historical) return;
        before the first line in OBU that starts processing the strategy code.

        Comment


          #5
          Hi Kog:

          You mean here (below in red in between these two lines)? Will that allow me to enable the strategy while it is set to Calc on bar close False to only start entering trades on the next valid signal and not on any historical signals that may be active upon enabling?

          protected override void OnBarUpdate()
          {
          if (Historical) return;
          if (Position.MarketPosition == MarketPosition.Flat)

          Comment


            #6
            also...it will still allow for past closed bars to be considered for future real time signals though right...? The strategy does need to look back several bars to calc future bars...just making sure...thanks kog...

            Comment


              #7
              Originally posted by birdog View Post
              also...it will still allow for past closed bars to be considered for future real time signals though right...? The strategy does need to look back several bars to calc future bars...just making sure...thanks kog...
              That construct just means that no calculations are done on historical bars, but historical bars can be referenced from any bar, including the realtime bars. So, if you are not populating any variables in the historical phase, that should do it. If you are populating stuff, you just need to make sure that your skip comes after whatever you need to populate, but before you want to take trades.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              649 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              370 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              109 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              573 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              576 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X