close trade after candle close

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #160164 quote
    Stocks008
    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
    robertogozzi
    Moderator
    Master

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

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 Stocks008
5 years ago.

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