Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Close a position at a certain time of the day

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

    Close a position at a certain time of the day

    Hi

    I would like to know syntax of the action that closes a position.
    My current syntax is the following:

    if ((Position.MarketPosition == MarketPosition.Long)
    && Times[0][0].TimeOfDay >= DateTime.Parse("07:30", System.Globalization.CultureInfo.InvariantCulture) )

    If the text above is true I want the order to be closed.

    Thanks in advance


    #2
    Hello henryd333,

    Thank you for the post.

    To close a position you would need to submit an order which brings you back to flat. If you are long you could submit an ExitLong order to become flat.



    Please let me know if I may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    90 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    137 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
    120 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    71 views
    0 likes
    Last Post PaulMohn  
    Working...
    X