DEFPARAM FlatAfter for long or short

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #212830 quote
    Paolo.B
    Participant
    Average

    Hello, differentiated closing is possible for Long and Short operations.
    If possible, I would like to close the open transaction by the end of the day.
    If it’s Long At 20.30
    If it’s Short at 21.30
    Using ( DEFPARAM FlatAfter ) you can only close at one time.
    Thank you

    #212885 quote
    robertogozzi
    Moderator
    Master

    Use

    IF LongOnMarket AND Time = 203000 THEN
       SELL AT MARKET
    ELSIF ShortOnMarket AND Time = 213000 THEN
       EXITSHORT AT MARKET
    ENDIF

    of course you must use a TF whose candle closes at the said times.

    Midlanddave and Paolo.B thanked this post
    #212926 quote
    Paolo.B
    Participant
    Average

    Thanks, it works perfectly

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

DEFPARAM FlatAfter for long or short


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Paolo.B @paolo-b Participant
Summary

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

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