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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        62 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        134 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X