STOP LOSS using ATR

Forums ProRealTime English forum ProOrder support STOP LOSS using ATR

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

    Hello,

    I’ve been trying different Stop Loss techniques and I have come up with something using ATR. Ive added it to my code as a trailing stop loss but it seems that it is not be calculated as I want it to be. It seems it is not trailing the highest or lowest price made.I am using a 15 minute time frame. Can anyone help me out here ??

    thankyou !

    #197228

    If you insert below in your code, the value will show you the number of points price needs to move before the TS starts to move.

    When Set Stop PTrailing does start to move, it only moves 1 point for every 1 point change in price.

     

    1 user thanked author for this post.
    #197229

    Hi GraHal,

    thank you. As far as I can see the Stop Loss is not moving up or down correctly with new price highs or lows depending on long or short. Ive attached a screen shot. Am I correct in assuming that the stop loss for this marked 15 minute bar will be 104,67 and will only change after the bar has closed? In this case (I went short on the open of the bar at 12653,3) the price then went down to 12631,5 before rising and I was closed out at 12716,5. From my understanding the StopLoss should have trailed 21 points which means it would have bee 83 points from my entry point so around 12736 but this as not the case since I was closed out at 12716,5. Or am I taking the wrong value for the stop loss? Should i be taking the value on the graph of the 15 minute bar before the trade opens?

    If you look at the 2nd screenshot I did and the marked bar which is also a trade I cannot understand how the trade as stopped out so much lower than I am assuming the Stop Loss should be. How much should the trailing stop loss have been, max 84 right? Or possibly even less if I am reading wrongly and it should be the value from the bar before.

    I really appreciate your help!

    #197233

    Replacing SET STOP ?TRAILING with a trailing stop code snippet is usually recommended.

     

    #197236

    I’m sorry I don’t know what a snippet is…

    #197237

    It’s a piece of code that replaces the built-in TRAILING instruction.

    It’s quite easy to use, actually you don’t even need to code, just copy & paste lines 17- 56 (at https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/) and append them at the end of your code after removing the SET STOP PTRAILING line.

    This is the code:

    You only have to set the two values trailingstart and trailingstep to the ones you prefer.

    2 users thanked author for this post.
    #197243

    what a snippet is

    Click on below and you will have a pleasant surprise! 🙂

    Snippet Link Library

     

    1 user thanked author for this post.
    #197245

    Wow! thanks a million!

    1 user thanked author for this post.
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