Trailing stop as a percentage for control

Forums ProRealTime English forum ProOrder support Trailing stop as a percentage for control

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

    Hello, I know there are already a lot of topics about trailing stops. Only some of them are equipped with extra functions that unfortunately I don’t really understand the code. I’m not a programmer …
    Based on Nicolas Code, I separated this into long and short with the help of Roberto and also built in a distance. This is to prevent the trailing from working below the minimum distance of the broker or exiting beforehand.
    Now I have tried to change this code from points to percent myself.
    Can an experienced programmer have a look over here? Does the code reliably do what it should? Without surprises?

    #181695

    The way it is written now, it always changes values each bar, which must not happen.

    Moreover I suggest that TRADEPRICE be used, instead of close, to calculate percentages.

    In addition you have to add PIPSIZE to calculatations.

    Replace lines 3-10 with these ones:

     

    1 user thanked author for this post.
    #181696

    I think lines 7 – 10 need to be (tradeprice/100) or (positionprice/100) rather than (close/100)

    otherwise, surely it’s going to read each new close and start measuring from there. the trail will only start if it gets to the trailingstart distance in one candle.

    (Roberto got in before me!)

    #181698

    Thanks Roberto, I’ll try.

    @nonethless: Doesn’t every trailing stop do that? I also like their trailing stop, but I miss the function of distance, i.e. the minimum distance.

    #181699

    no, it should measure from the entry price (tradeprice or positionprice) which doesn’t change. positionprice will change if you use cumulative orders, but the trail then measures from the aggregate.

    the minimum distance can also be resolved by ticking the box that says ‘Readjust stops’ when you launch the code. Then PRT automatically keeps your trail and SL at the min distance.

    #181701

    I tried that. It works on the live account. But it often doesn’t work on the demo account. At least for me. I do not know why. That’s why I wanted a second solution.

    #181703

    you might also experiment with:

    uses high and low as a trigger instead of close, so it goes to breakeven more quickly. ‘close’ sometimes produces more profit whereas using ‘high,low’ is more protective, higher % win – depends on which you prioritise.

    3 users thanked author for this post.
    #181704

    In a quick direct comparison, your trailing stop is worlds better and takes a lot more profits. I have to check that with a little more time to find out why. Unfortunately I don’t have any more time today.

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