close positions at Friday close

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #202470 quote
    LoveTheCode!
    Participant
    Junior

    hi, could someone please help with how to close open position at the end of the week (i.e. market close on Friday??? )

    I have been trying the below but not working:

    // Conditions to exit long positions
    c1 = OpenDayOfWeek = 5
    c2 = CurrentTime = 163000

    IF c1 AND c2 THEN
    SELL AT MARKET
    ENDIF

    It might also be possible with defparameters flatafter but that is only in format HHMMSS so doesn’t seem to allow for the day of the week

    Thanks in advance for any help !

    #202472 quote
    JS
    Participant
    Senior

    Hi @LoveTheCode!

    Use: c1 = CurrentDayOfWeek = 5

    #202490 quote
    LoveTheCode!
    Participant
    Junior

    thanks JS, works nicely

    JS thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

close positions at Friday close


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by LoveTheCode!
3 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/13/2022
Status: Active
Attachments: No files
Logo Logo
Loading...