BreakEven & Trailing Profit: complete function

Forums ProRealTime English forum ProOrder support BreakEven & Trailing Profit: complete function

Viewing 15 posts - 16 through 30 (of 120 total)
  • #151590

    I added lines 9 and 10 for settings, then lines 29-32 and lines 49-52 for the code to manage the additional percentage.

     

    1 user thanked author for this post.
    #151641

    nonetheless, what algo is it you are using in your pictures? MOD?

    #152033

    Thank you Roberto for the kind help! I have just updated my code with this and trimmed some parameters so now it is up in the Demo, will be interesting to see the result in the coming weeks. Thanks!

    1 user thanked author for this post.
    #153839

    a try to cover a position on the trailingstop of robertogozzi

    Basically it uses the levels of Donchian if the trade is triggered. If the trailing stop is not triggered, it uses previous determined lows before the trade to exit, with in consideration to a minimum distance to the tradeprice.

    Also has a second exit method if above is not triggered and the lines are narrow. If it crosses the top line for a long and retraces back to the lowest it exits too, again with in consideration of a minimum distance between max & min levels

    With this, most likely with mistakes, I hope that if the market reverse there is an alternative way to exit the trade before going to the stoploss.

    Instead of a fixed amount to start the trailingstop, it uses now a %.  Pipsize is left out on the part I added. I’am unsure if it is * or /. What I added can be disabled.

     

     

    4 users thanked author for this post.
    #154903

    I am running this on a 5min strategy. My trailing has started but every 50 min  (barnumber 10×5(min) the stop does not move up additional 10% (barpercent). Why though?

     

    #154904

    (I am using Robertos code)

    #154936

    This works correctly with your settings:

     

    1 user thanked author for this post.
    #156726

    I was tired that day, Thanks Roberto!

    I like the trailing and it works well. I get the best results in backtest from having a low PerCentInc it mostly depends on some trades which have ran over 5% (1000 euro), meaning I dont run the strategy with a TP. MFE is in most of the times therefor very far away from the actual Abs Perf.

    The conclusion I have came with is that this trailing would be better if I added some more exits with it for example positions ends when trend is not so strong anymore or others and there for end its position.

     

    Maybe this can save someones time. Good luck!

     

     

    #156740

    Hi

     

    apologies if this is obvious to the pros out there, but im still getting to grips with trailing stops.

     

    lets say I usually have a fixed TP of 75 pips.
    However, instead of closing at 75, im happy to let it run, up to say…. 150 pips (or some other indicator) but I want to make sure I take a minimum of 50 pips profit if it reverses… can I use this code for that and what settings would I need?

     

    Thanks!

    #156742

    In your case you’d better use the code snippet at https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/ (linesd 17 – 56) replacing lines 19 and 20 with, say, 75 and 50.

     

    1 user thanked author for this post.
    #156746

    Exactly what I needed.. many thanks Robert – And Nicolas for the code.

    #158701

    Ciao Roberto, would this work with cumulative orders? by changing tradeprice to positionprice? or does it need more than that?

    #158822

    nonetheless, it’s actually  a bit more complex, because each new bar it might have accumulated more or less positions, so the previous trailing exit, if any, needs to be adjusted. It will keep the older one if it grants greater profits.

    This is the new code dealing with accumulation of positions. I suggest that it be used in ANY case, though, since it will operate correctly even when not accumulating, it will simply never detect different position sizes and PositionPrice will match TradePrice:

     

    2 users thanked author for this post.
    #158832

    Roberto, you are a megastar. I was just in the middle of trying to work it out for myself but it was making my head hurt.

    Hugely appreciate all the work you put in here!

    1 user thanked author for this post.
    #158836

    BTW, I have been using this to make it work as a % trailing start:

    So presumably I now change tradeprice to positionprice ?

Viewing 15 posts - 16 through 30 (of 120 total)

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