Close after X minutes

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #100059 quote
    OMXetOMXet
    Participant
    Junior

    Hi

    I’m sure the answer is somewhere at this forum but I can’t find it so:

    How to code “Close after X minutes”

    #100064 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    What TF are you using?

    Close after X minutes from…. the opening of a trade,  no matter whether it’s gaining or losing?

    #100131 quote
    OMXetOMXet
    Participant
    Junior

    At the moment 5 sec.

    Yep, X minutes after opening whatever the result is.

    #100137 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    This should work (not tested):

    IY MyConditions THEN
       BUY/SELLSHORT....
       MyMinute = OpenMinute
    ENDIF
    x = OpenMinute - MyMinute
    IF x < 0 THEN
       x = x + 60
    ENDIF
    IF x >= 5 THEN
       SELL/EXITSHORT....
    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 after X minutes


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
OMXet @omxet Participant
Summary

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

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