Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

best practice with CalculateOnBarClose

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

    best practice with CalculateOnBarClose

    greetings,

    wanted to see what "best practice" was for the following situation:
    - entry signals generated only on bar-close
    - stop adjusted on each incoming tick (eg. not bar-close)

    as i see it, there are two options:
    A. set CalculateOnBarClose to true; place entry in OnBarUpdate(); use OnMarketData() to handle incoming-tick for stop.
    B. set CalculateOnBarClose to false; only fire entry after CurrentBar increments; adjust stop by referencing Close[0], as applicable.

    three questions:
    1. are the methods outlined in A and B above valid/correct/legit?
    2. is one method preferable to the other?
    3. are there other methods (C, D, E, etc.) to accomplish this? and if so, which ones are worthy of the title "best practice"?

    in the event that this is out-of-scope for the Ninja team to answer, i would certainly welcome any comments from the community. thanks in advance :-)

    cheers,
    -e

    #2
    Hello Eman,

    Thank you for your post.

    1) Both are valid.
    2) Method B is generally easier to program.
    3) Not aware of other methods to do this.


    We have the reference sample below that illustrates one approach to this:

    Separating strategy logic to either calculate once on bar close or on every tick.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      excellent! thank you very much -- exactly what i needed.

      cheers,
      -e

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X