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 cmoran13, Yesterday, 01:02 PM
      0 responses
      30 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      22 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      160 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      95 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      148 views
      2 likes
      Last Post CaptainJack  
      Working...
      X