DEFPARAM FlatAfter for long or short

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #212830 quote
    Paolo.BPaolo.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
    robertogozzirobertogozzi
    Moderator
    Legend

    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.BPaolo.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.
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

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.BPaolo.B
3 years, 5 months ago.

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