Trigger Trailing SL if target is met

Forums ProRealTime English forum ProOrder support Trigger Trailing SL if target is met

Viewing 15 posts - 16 through 30 (of 69 total)
  • #198335

    Ok ,but how would I then go about if I want a trailing stop to start at just that level where   indicator3<span class=”crayon-o”>[</span><span class=”crayon-cn”>2</span><span class=”crayon-o”>]</span> <span class=”crayon-st”>CROSSES OVER</span> indicator4<span class=”crayon-o”>[</span><span class=”crayon-cn”>2</span><span class=”crayon-o”>] </span>? Is it possible to  store this value in a constant that I can later use in “trailingstarts?

    #198336

    Is it possible to  store this value

    Value of what … price at crossing or what?

    #198408

    Yes exactly, and have the price at crossing to be where trailing starts

    #198411

    My code does what you state above, but you still need a start and step value, for example 30, in the code so when price drops by >= 30 the trade will exit.

    If you have start value = 0 then if price drops by 1 point then trade exits.

    You are imagining that Trail starts at crossover and then price only goes up from there … what if you are Long and price goes down after crossover??

    You need to do loads of tests using your Demo Platform to see how all this hangs together else you will forever be working on ‘how you think PRT works’. 

     

    1 user thanked author for this post.
    #198440

    1y backtesting gave 50 trades and 8.8% time in market. Stoploss was never triggerd during this year.

    This is with the trailing stoploss triggerd at c2. Trailingstart and trailingstep set to 1 should give a similar result as to the one without trailing stop.

    1y backtesting gave 23 trades and 61% time in market. Stoploss was  triggerd 2 during this year.

    I tried with different values for trailingstart and trailing step, but nothing works. As you can see the trailing stop does not work as it should and does almost never sell where it should, and that is “why time in market” goes from 8% to 61%. The results are day and night and they should be almost the same.

     

    After alot of detective work. The second one with trailing, will only trigger “IF indicator3[2] CROSSES OVER indicator4[2] AND (now this is strange) if 2 candles after the cross over the candle goes lower then the close of the one before”

    Somehow the trailing stop gets bound with what happends 2 candles after C2 and works ONLY in this candle and ONLY if this cadles low is lower then the previous candles close. And if it dont happend this candle, the bot needs to wait for next C2 bore it can try again. This almost never happends and this is why time in market exploded.

    (Yes I have a delay on the sale with 2 candles, but I have the same problem with my bots without it)

    I hope I make some sence, and if you have time can help me from here

     

    #198443

    The logic sounds familiar to me. What time frame?

    #198445

    30 min

    Yes somehow the trailing stop gets bound to this and only this candle and only work here.

     

    Now we just need to set it free 🙂

    #198446

    trailingstart = 1 and trailingstep =1 is nonsense.
    Just run it through the optimizer.

    trailingstart from 20 to 200 in increments of 10 and trailingstep from 5 to 50 in increments of 5. Should be quick.

    #198449

    Yes 1 and 1 is nonsence. But they should give the same result as the one without trailing stop, and it does not.

    Have tried manually alot of differnet numbers and can ofc get a better reslut then when I use 1 and 1.

    But no matter what numbers I use, It still only works in just that 1 candle and this is the problem.

    (Don’t know that optimizer is, mb you can link smt?)

    #198450

    No, can’t give the same results at all. In your case the system would try to secure a point if you win one point. which is bullshit. Can someone please show him the basics? I don’t have a laptop here.

    #198451

    Why are you using below … this means the cross occured 2 bars ago?

    Why not use …

     

     

    #198452

    Re settings for Start and Step … it be very useful to get your head around how a Trailing Stop works …

    https://www.investopedia.com/terms/t/trailingstop.asp

    https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/

     

    #198453

    Yes it would close out almost immediately, just like if diden’t even have it.

    But the problem is not if I use 1-1 or 1-30

    The problem is the trailing stop ONLY work in one candle.

     

    #198454

    Yes I want it to sell on delay from cross.

    But the problem remains indicator3(2) or indicator3, the trailing stop ONLY works in just that one candle.

    #198467

    trailing stop ONLY works in just that one candle.

    It will with a Start of 1 and a Step of 1 or 30 ?

    Post your latest code and I will test it on my Platform.

     

    1 user thanked author for this post.
Viewing 15 posts - 16 through 30 (of 69 total)

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