Close after x bars

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #93050 quote
    ricoTSricoTS
    Participant
    New

    Hi,

    Is there a way to close all opened positions after x bars?

    Thanks,

    #93052 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Yes:

    IF (Barindex - Tradeindex) >= 10 THEN   //close all positions after 10 bars
       SELL AT MARKET                       //No matter if LONG or...
       EXITSHORT AT MARKET                  //... SHORT ones
    ENDIF
    #93058 quote
    ricoTSricoTS
    Participant
    New

    thank you

Viewing 3 posts - 1 through 3 (of 3 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 bars


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
ricoTS @ricots Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by ricoTSricoTS
7 years, 8 months ago.

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