Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLong vs ExitLongStop in OnExecution()

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

    ExitLong vs ExitLongStop in OnExecution()

    Hi,

    I have a number of stop types in operation some use ExitLongStop, some use ExitLong. I have a section of code in OnExecution that prints to screen when a stop is actioned, however it only reports back for the ExitLongStop and not for the ExitLong.

    Here are two examples that would appear in OnBarUpdate:

    Code:
    stopOrder = ExitLongStop(0, true, 1, stopPrice, "MyLongTrailingHighOrLowStop", "MyLongEntry");
    
    stopOrder = ExitShort("MyShortTicksStop", "MyShortEntry");
    Then within OnExecution I filter on exits using the following and within this if loop I print to screen:

    Code:
    if (stopOrder != null && stopOrder == execution.Order)
    Using this I only ever get print to screen working for the ExitLongStop even though both stops would be actioned and the Strategy Analyzer results show this accurately.

    However if I refer to the execution exit by name then I can get results for the ExitShort. That is if my if loop looked like:

    Code:
    if("MyShortTicksStop" == execution.Name)
    Why doesn't the reference to stopOrder work for ExitShort while it does for ExitLongStop? It would be preferable to not have to refer to each exit type by name.

    Thanks in advance,
    darmbk.

    #2
    Hello darmbk,

    Thank you for your post.

    Do you see the same behavior when calling the IOrder object for the ExitShort() only? You can do this by commenting out the ExitLongStop() or by setting specific IOrder object names for each exit.

    In addition, are you setting the IOrder object to null when the order is filled? Are you going both long and short in the strategy?

    Comment


      #3
      Apologies Patrick,

      I can no longer replicate the error. My stops are all reporting correctly now.

      Thanks,
      darmbk.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      582 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      338 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      552 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X