Exit parameters

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #164419 quote
    Donovan Meuwsen
    Participant
    New

    Hi All,

    How would you code your Exit of a long(/short) with the following conditions please?

    • Exit (StopLoss) when price hits at DoncianChannelDown(/UP) of the moment of Opening Position (so not trailing)
    • Exit (TakeProfit) when price is 1,5 x (PRICE at Opening of Position – DolcianChannelDown(/UP))

    Thanks a lot for your wisdom!

    #164434 quote
    robertogozzi
    Moderator
    Master

    There you go:

    IF MyLongConditions THEN
        BUY 1 Contract AT MArket
        SL = (close - DonchianChannelDown[20])
        TP = SL * 1.5
        SET STOP LOSS SL
        SET TARGET PROFIT TP
    ENDIF
    IF MyShortConditions THEN
        SELLSHORT 1 Contract AT MArket
        SL = (close - DonchianChannelUp[20])
        TP = SL * 1.5
        SET STOP LOSS SL
        SET TARGET PROFIT TP
    ENDIF
    #164450 quote
    Donovan Meuwsen
    Participant
    New

    grazie mille Roberto!

    thank you very much Roberto!

    #164452 quote
    robertogozzi
    Moderator
    Master

    Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums

    Thank you 🙂

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

Exit parameters


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Donovan Meuwsen @dpm380 Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzi
4 years, 11 months ago.

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