Close positions and no new entry

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #120884 quote
    bullbear
    Participant
    Senior

    How do i code this?

     

    I want my long positions to close on Friday night 22:00 and no more entry after 22:00 on Friday.

    IF DAYOFWEEK = 5 AND TIME = 220000 THEN
    SELL AT MARKET
    ENDIF

    I use this but a new position open 22:10 on Friday.

    #120886 quote
    Francesco
    Participant
    Veteran

    Try this

    if opendayofweek = 5 and openhour >= 22 and openminute >= 00 then
    sig=1
    else
    sig=0
    endif

    Then you have to put sig=1 into your entry conditions

    bullbear thanked this post
    #120887 quote
    robertogozzi
    Moderator
    Master

    Add this to your conditions when BUYing:
    [scode]
    AND Not (Time >= 220000 And DayOfWeek = 5)
    [/scode]

    bullbear thanked this post
    #120888 quote
    bullbear
    Participant
    Senior

    like this 🙂

    if sig=1 then
    sell at market
    endif
    
    // Friday 22:00 Close ALL operations.
    
    
    if opendayofweek = 5 and openhour >= 22 and openminute >= 00 then
    sig=1
    else
    sig=0
    endif
    
    IF c1 AND C2 AND C3 AND Not (Time >= 220000 And DayOfWeek = 5)  THEN
    BUY 3 CONTRACT AT MARKET
    ENDIF
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Close positions and no new entry


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
bullbear @bullbear Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by bullbear
5 years, 12 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/01/2020
Status: Active
Attachments: No files
Logo Logo
Loading...