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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      60 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      148 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      162 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      97 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      284 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X