Close losing trades after x bars, leave winning trades open

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

    Hi all,

    is there a way to close losing trades after x amount of bars whereas the trade would remain open when in profit?

    I know how to theoretically close all trades after x amount of bars, but am struggling to find a way to include running P/L into the condition.

    Thanks!

    #191324 quote
    nonetheless
    Participant
    Master
    IF longonmarket and barindex-tradeindex(1)>= b1 and positionperf<0 then
    sell at market
    endif
    IF shortonmarket and barindex-tradeindex(1)>= b2 and positionperf<0 then
    exitshort at market
    endif
    Raspberri and Nicolas thanked this post
    #191325 quote
    Raspberri
    Participant
    New

    Awesome, thanks! 🙂

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

Close losing trades after x bars, leave winning trades open


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Raspberri @raspberri Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Raspberri
3 years, 10 months ago.

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