Trailing Stop Clarification

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #213077 quote
    KumoNoJuzza
    Participant
    New

    Hi,

    I have 2 questions regarding trailing stops.

    1 – In the following example:

    SET TARGET pPROFIT 75
    SET STOP pTRAILING 25
    SET STOP pLOSS 35

    I don’t understand when is the trailing stop executed if ever. Does the instruction sequence matter even if the Stop Loss in not touched?

    2 – Is it possible to have an active trailing stop as a condition?

    If longonmarket AND trailingstop // Active TrailingStop
       THEN Buy 1 Contract	// Position Size Increasing
    ENDIF

    Thanks for your help and patience

    #213133 quote
    robertogozzi
    Moderator
    Master

    In the sequence:

    SET TARGET pPROFIT 75
    SET STOP pTRAILING 25
    SET STOP pLOSS 35

    the trailing stop will never be executed, as the last two lines are concurrent types of stop loss and, being the code read and executed sequentially, the last line will always override the previous one.

    Your second snippet:

    If longonmarket AND trailingstop THEN// Active TrailingStop
       Buy 1 Contract ....	// Position Size Increasing
    ENDIF

    has THEN misplaced in the line after IF, while it must be the last keyword in the same line as IF (comments aside). Anyway, the code seems correct, provided you have assigned trailingstop  a value other than 0, based on a trailing stop snippet you have placed somewhere in your code.

    KumoNoJuzza thanked this post
    #213143 quote
    KumoNoJuzza
    Participant
    New

    Thanks Roberto. And thus I am lucky my strategies are profitable – I am still in papertrading -as they are not behaving as expected !!

    With that sequence:

    SET TARGET pPROFIT 75
    SET STOP pLOSS 35
    SET STOP pTRAILING 25

    Will the trailing stop be executed? Or will it be interrupted at each new candle by the stop loss ?

    If so, I guess it is better to code the trailing stop. I found the code in the forum

    #213148 quote
    GraHal
    Participant
    Master

    As you have written the code in the post above …

    SET STOP pLOSS 35 will not be executed.

    SET STOP pTRAILING 25 will be executed.

    If you want SET STOP pLOSS 35 to execute then you will need to use a coded version of Trailing Stop.

    There are loads here … 🙂

    Snippet Link Library

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

Trailing Stop Clarification


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/11/2023
Status: Active
Attachments: No files
Logo Logo
Loading...