Close after x bars

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

    Hi,

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

    Thanks,

    #93052 quote
    robertogozzi
    Moderator
    Master

    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
    ricoTS
    Participant
    New

    thank you

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

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

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