Close positions and no new entry

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #120884 quote
    bullbearbullbear
    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
    FrancescoFrancesco
    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
    robertogozzirobertogozzi
    Moderator
    Legend

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

    bullbear thanked this post
    #120888 quote
    bullbearbullbear
    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTimeā„¢ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 bullbearbullbear
6 years, 7 months ago.

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