close trade after candle close

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #160164 quote
    Stocks008Stocks008
    Participant
    Average

    Good day,

    I would like to close a trade after a candle closes. For example:

    If the current candle breaks the high of previous candle, the trade would enter long at the broken high, but when the candle that entered closes, the trade should close with profit/loss. Basically the trade should last 1 candle only. I only need to know how to make it close at the end of the current candle period.

    Thank you,

    #160165 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    LONG example.

    At the beginning of your code, just after DEFPARAM……. (if any), add these lines:

    IF LongOnMarket THEN
       SELL AT MARKET
    ENDIF
    Stocks008 thanked this post
    #160167 quote
    Stocks008Stocks008
    Participant
    Average

    Seems to be working 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 trade after candle close


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Stocks008 @jd008 Participant
Summary

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

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