Need a trailing stop loss that moves more dynamic

Forums ProRealTime English forum ProOrder support Need a trailing stop loss that moves more dynamic

Viewing 15 posts - 1 through 15 (of 19 total)
  • #62034

    So until now i have been using the MFE/TSL thats on the forum, this is has been working OK, but i see major flaws with this..

    Lets use an example:

    trailingstop = 20
    StartTrailingStopValue = 40

     

    This means that the trailing stop will activate when 40 pip profit is made, and the trailing stop is then 20 pips

    Now, to move the trailing stop i would like 1 pip more in profit = 1 pip more in stop loss, but with this stop loss that im using today, i need another 40 pips of profit before the stop loss moves up 20.

    I need a stop loss that moves +1 for every pip i make, after 40 pips of profit.

    I think that i have seen such a code on this forum? but i cant seem to find it, or i might have misunderstood what i read then.

     

    So if i have 100 pips of profit, my stop loss is only 40, but i want it to be @ 60 pips. I want the stop loss to start @ 40pips profit, and just continue 1 pip up for every pip i make in profit.

     

    Can someone help me? 🙂

    #62055

    I realise that what i wrote might have been confusing to read, sorry and let me rephrase so its more understandable.

     

    As it is now, the trailing stop loss im using moves the stop loss 20 pips up, for every 40 pips of profit i make.

     

    What i would like is a stop loss that works like this:

    When the trade starts, my target is 200 pips and stop loss is 90 pips.

    If my trade gets 40 pips in profit i want a trailing stop loss to start, with 40 pips as trailing stop.

    In other words, when i get 40 pips profit, my new stop loss is 0 pips profit.

    If my trade goes to 60 pips profit, my new stop loss is at 20 pips profit. (60 pips profit in trade- 40 pip trailing stop loss = 20 pips profit)

    if my trade goes to 100 pips profit, my new stop loss is at 60 pips.  ( 100 pips profit in trade – 40 pip trailing stop loss = 60 pips profit)

     

    I realize PRT systems can only move the stop loss after each candle(?), and thats fine, gotta live with that. Unless it can work with the equity curve, calculating my highest high in EQ curve and calculate new stop loss as it moves up or down in profit? But anyways, if the candle moves 5 or 20 pips up, before it closes, i want the stop loss moved every time my profit is peaking above 40+ pips.

     

    I hope this was more clear.

    #62084

    This a combination of Nicolas‘ Breakeven & Trailing Stop code (https://www.prorealcode.com/blog/learning/breakeven-code-automated-trading-strategy/ & https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/).

    I did not test it much, nor did I use GRAPH to debug it. Give me some feedback.

    You may insert this code in your strategy provided you first set the three variables:

    • trailingstep        = number of pips to add to your profit, after breakeven, while on the rise, as a safeguard in case the market reverses
    • startBreakeven = number of pips to wait before setting your SL to breakeven
    • PointsToKeep   = number of pips to add to breakeven so that it’s not so even (thus less painful if hit)

     

    #62087

    Sorry, I attached the same code twice!

    #62097

    Hi Robert, thanks for the reply, sadly that does not help me as much.

    I need the stop loss to be activated at 40 pips profit, and then just constantly work as a normal trailing stop loss. So if my trade goes to 55 pips profit, my stop loss should be at 15 pips profit.

    Am i reading the code wrong?

     

    #62099

    Hi Robert, thanks for the reply, sadly that does not help me as much. I need the stop loss to be activated at 40 pips profit, and then just constantly work as a normal trailing stop loss. So if my trade goes to 55 pips profit, my stop loss should be at 15 pips profit. Am i reading the code wrong?

    Unless there’s some logic error in the code, you should set:

    • startBreakeven = 40
    • set trailingstep = 15
    and it should do. Did you test it?
    As for PointsToKeep ,  it only affectes the way you consider BreakEven, if ZERO it is a true BreakEven, any other value is BreakEven +- some pips, but it does not (well… it should not, I did not test it).
    #62100

    Hey, ive tried with the settings u said, but same results.

     

    Added photo to show what i mean

    #62103

    Oh i think i have read the MFE trailing wrong, cus it seems to do what i need to do.

    Ill start testing with this and see if its right 🙂

     

     

    #62105

    Line 27 of tje code I posted should be replaced by

    so that the SL is not affected by the value in PointsToKeep.

    As for the rest I tested it on DAX 5min and it works finely!

     

    #62108

    My previous post (#62105) should be ignored, PointsToKeep will always affect NewSL, unless you do some math to remeber, for the second setting of NewSL, to subtract PointsToKeep pips that were added the previous setting. This could be done, but it complicates a bit the code.

    So if you set:

    • trailingstep        = 10
    • startBreakeven = 30
    • PointsToKeep   = 2

    BreakEven will be activated when your profit reaches 30+ pips (at closing time) and the SL would be set at a 2 pip-profit (BreakEven + PointsToKeep).

    Then the code will wait till SL + trailingstep (at closing time)  is reached to update it to 12. And so on…

     

    #62124

    Hi again Robert, so im wondering: if the candle HIGH is above 30, but the close is below 30, will the stop loss be activated then?

    What i dont like about that code is that it will only move the stop loss for every 30 pip i reach, right?

    Så it moves the stop loss when i go above 30, but it will not move the stop loss if i reach 50 pips in profit, but at 60 pips profit it will move the stop loss again, am i right?

    What i would like is something that moves the stop loss all the time, regardless if im 40 pips up, or 50 or 80. it will always be 40 pips below my profit-peak.

    i think the MFE trailing stop loss that i copy/pasted there is doing just that ^

    #62131

    Hi again Robert, so im wondering: if the candle HIGH is above 30, but the close is below 30, will the stop loss be activated then? What i dont like about that code is that it will only move the stop loss for every 30 pip i reach, right? Så it moves the stop loss when i go above 30, but it will not move the stop loss if i reach 50 pips in profit, but at 60 pips profit it will move the stop loss again, am i right? What i would like is something that moves the stop loss all the time, regardless if im 40 pips up, or 50 or 80. it will always be 40 pips below my profit-peak. i think the MFE trailing stop loss that i copy/pasted there is doing just that ^

    1 – if the candle HIGH is above 30, but the close is below 30, will the stop loss be activated then? NO, it will not

    2 – What i would like is something that moves the stop loss all the time, regardless if im 40 pips up, or 50 or 80. Set startBreakeven=xx and trailingstep=1

    This is not a real Trailing Stop as a native trailing stop. It’s just sort of…. written by Nicolas to overcome some limitations by IG/PRT native trailing stop support. We all have to wait for a better one when the new version is available.

     

    #63322

    thanks for the info!

    #63477

    Can you combine this code with a SL? If the market goes wrong from start, you will not get out of position.

    #63510

    You can add a SET STOP LOSS instuction if you want, for sure.

Viewing 15 posts - 1 through 15 (of 19 total)

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