ATR Take Profit and Stop Loss

Forums ProRealTime English forum ProBuilder support ATR Take Profit and Stop Loss

Viewing 5 posts - 1 through 5 (of 5 total)
  • #221073

    Hello could you convert this please from Tradingview into pro-real-time code

    I have one I have been using but it is not as correct as this thank you

     

    1. This is an indicator specially made for NNFX traders who use the ATR rule of ATR1x for Take Profit and ATR1.5x for Stop Loss

    The indicator:
    1. It can be used for a quick look using the lines to see instead of calculating whether price hit a TP or SL. However I have kept the Main ATR for those who want to record the ATR into the spreadsheet when back testing or forward testing
    2. When placing a buy/long order, TP is blue and appears above price, SL is red and appears below price
    3. When placing a sell/short order, TP is blue and appears below price, SL is red and appears above price
    4. The Main ATR, which is yellow, is way below price because I didn’t want the chart to be overwhelmed by a 5th line in the middle of 2 TPs and SLs aka make the chart look claustrophobic

    #221114

    Here is below the translated code for this NNFX indicator that display the ATR takeprofit and stoploss for both Buy and Sell orders:

     

    2 users thanked author for this post.
    #239389

    Thanks but not exactly what i had in mind. I use this code to know when to take my stop:

    // Période
    p = 5

    // Average True Range X
    ATRx = AverageTrueRange[p](close) * 3.5

    // ATRts = ATR Trailing Stop

    // Inversion de tendance
    IF close crosses over ATRts THEN
    ATRts = close – ATRx
    ELSIF close crosses under ATRts THEN
    ATRts = close + ATRx
    ENDIF

    // Cacul de l’ATRts lors de la même tendance
    IF close > ATRts THEN
    ATRnew = close – ATRx
    IF ATRnew > ATRts THEN
    ATRts = ATRnew
    ENDIF
    ELSIF close < ATRts THEN
    ATRnew = close + ATRx
    IF ATRnew < ATRts THEN
    ATRts = ATRnew
    ENDIF
    ENDIF

    return ATRts as “ATR Trailing Stop”

    But i dont want it to be active until i have reached a certain profit level. For example, i take an entry at in the SP500 at 5820. When it reaches 5840 the ATR stop begins under the previous bar.

    Is this possible to program?

    1 user thanked author for this post.
    #239431

    Thanks but not exactly what i had in mind.

    Of course it isn’t. It is what Patrick K Templar asked for 🙂

     

    #239470

    Cela imprimera sur la bougie actuelle et ⬆︎ en dessous de la bougie précédente, lorsque le prix actuel dépasse le HAUT des 20 bougies précédentes :

     

Viewing 5 posts - 1 through 5 (of 5 total)

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