Bar by Bar Trailing Stop

Forums ProRealTime English forum ProOrder support Bar by Bar Trailing Stop

Viewing 8 posts - 1 through 8 (of 8 total)
  • #216413

    Hello,

    I am trading only stocks and I try to add a bar by bar trailing stop to my position.

    At the moment the stop managment looks like this: Entry / SL 20cents / Move SL to Break Even when position is up 25 cents / Take profit at +32 cents

    I would like to replace the Take profit with a BbB trailing stop, means when the current bar closes on a new 5 period high, the stop goes under this closed bar.

    Code:

    // Stops und Targets: Legen Sie hier schützende Stops und Profit Targets fest
    SET STOP LOSS 0.20
    SET TARGET PROFIT 0.32

    IF LONGONMARKET THEN
    IF HIGH-Tradeprice >= 0.25 THEN
    SET STOP BREAKEVEN
    ENDIF
    ENDIF

    Thanks for help

    Regards André

    #216415
    JS

    Hi, Try this trailing stop…

    1 user thanked author for this post.
    #216418

    Thank you for help, but I guess that is not what I mean. I will post an example chart

    #216424

    without the Breakeven Term it must be like this:

    BbB= High[0]-Low[0] + 0.01

    // Stops und Targets: Legen Sie hier schützende Stops und Profit Targets fest
    SET STOP LOSS 0.20

    IF LONGONMARKET AND Close[0] > Highest[5] (High[1]) THEN
    Set Stop Price High[0] – BbB
    ENDIF

    IF SHORTONMARKET AND Close[0] < Lowest[5] (Low[1]) THEN
    Set Stop Price Low[0] + BbB
    ENDIF

    #216429

    Try appending these lines to your code:

     

     

    1 user thanked author for this post.
    #216433
    JS

    Hi

    I’ve modified the original trailing stop to your terms…
     
     

    1 user thanked author for this post.
    #216476

    Thanks all for your help, I now coded a combination of both terms and see how it will works

    #223209

    Hello,

    following question regarding my code for a BE and then trailing stop:

    The code works fine so far. But I have the problem, that , if condition 2 is fullfilled and it comes to a trailing stop, the first BE +0,01 Stop also remains in the system. How can I delete the first BE +0,01 stop, after condition 2 is fullfilled?

    Thanks for help

    //Manage Long Position / BE Stop / Bar by Bar Trail Outside Candle
    IF LONGONMARKET THEN
    //Breakeven SL at +0,20
    IF StopPrice = 0 AND High – TRADEPRICE >= 0.20 THEN
    StopPrice = TRADEPRICE +0.01
    ENDIF
    //Bar by Bar Trail Outside Candle
    IF StopPrice > 0 AND Close > Highest[5] (High[1]) THEN
    StopPrice = Low -0.01
    ENDIF
    ENDIF

Viewing 8 posts - 1 through 8 (of 8 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login