Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Detect end of session trade

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

    Detect end of session trade

    In my strategy, I have IsExitOnSessionCloseStrategy set to true.

    I am compiling my own statistics in the strategy and would like to identify when trades close due to it being the end of the trading session.

    What is the best way to do this?

    #2
    Hello reynoldsn,

    For your logic to be called for the order event that closes the position you would need to use the OnExecutionUpdate override to know when the order was filled. You can look for an execution with the name "Exit on session close".

    Comment


      #3
      Thank you for the reply - let me clarify what I'm doing.

      So I'm backtesting CL 05-16
      The last trading day is 4/15/2016
      The play back ends on 4/15/2016 at 18:00

      Currently I'm using this logic to print stats:
      Code:
      if(Bars.IsLastBarOfSession)
      {
      PrintSummary(Time[0]);
      }​
      But using this, I don't get a call to PrintSummary() at the end of playback.
      The last PrintSummary() I'm getting is at 4/14/2016 17:00

      I just need some way for PrintSummary() to run at the end of playback.

      Comment


        #4
        Hello reynoldsn,

        If you are trying to do something on the last bar you could make a condition: if(CurrentBar == Count - 2)

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        87 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        132 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        118 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        67 views
        0 likes
        Last Post PaulMohn  
        Working...
        X