3xATR indicator for trending/contrarian trades

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31614 quote
    rowestock
    Participant
    New

    Hello,

    Hello,  I have 2 requests which I was hoping the community could help with…….

    1. Please see the attached png. This shows the indicator called “ATR _ stop”. Please can you check the colours as the coloured point changes colour 1 bar late (I have inserted the code used below).

    // Période
    p = 10
    
    // Average True Range X
    ATRx = AverageTrueRange[p](close) * 3.0
    
    
    // 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"

    2. My second request is that we create code very similar to above, but what I want is:

    a) Data points marked on the price chart 3.0 ATRs above and below the last price where the ATR is 10.

    e.g. if current price is 533 and ATR (10) is 40.6, then data point below should be 411.2 [533 – (40.6×3)] and data point above should be 654.8 [533 + (40.6×3)].

    Your help is much appreciated!!

    :0)

    ANGLO-AMERICAN-ORD-USD0.54945.png ANGLO-AMERICAN-ORD-USD0.54945.png
    #32158 quote
    Nicolas
    Keymaster
    Master

    1/ this is the 1st code to color correctly the ATR stoploss line according to up/down Close above/below it as requested:

    // Période
    p = 10
    
    // Average True Range X
    ATRx = AverageTrueRange[p](close) * 3.0
    
    // ATRts = ATR Trailing Stop
    // Inversion de tendance
    IF close crosses over ATRts THEN
    ATRts = close - ATRx
    r=0
    g=200
    ELSIF close crosses under ATRts THEN
    ATRts = close + ATRx
    r=200
    g=0
    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 coloured(r,g,0) as "ATR Trailing Stop"

    For your second query, I understand that you want to draw a channel made of the upper and lower ATR band calculation?

    ATR-trailing-stop.png ATR-trailing-stop.png
    #32523 quote
    rowestock
    Participant
    New

    Thanks Nicolas. That is perfect for request 1  :0)

    On request 2, yes, an ATR band above and below the last price would be ideal.

    I would set the ATR as 10 periods and the bands above and below the the last price to be a multiple of 3.0.  Please see the attached chart pic.

    Obviously a 3*10ATR band will be quite wide, but each user can adjust their ATR multiple accordingly. They can also adjust their ATR period.

    Many thanks for your assistance!

    CAC40-Index.png CAC40-Index.png
    #32546 quote
    Nicolas
    Keymaster
    Master

    So it would not be displayed like the ‘supertrend’ style? Because even if it uses ATR, it is not updating each candle with the current ATR value.

    I think you are talking about ATR bands: https://www.prorealcode.com/prorealtime-indicators/multiple-atr-bands/

    #32790 quote
    rowestock
    Participant
    New

    Yes different from supertrend but the ATR bands look like they will do the job. Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

3xATR indicator for trending/contrarian trades


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
rowestock @rowestock Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by rowestock
8 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/10/2017
Status: Active
Attachments: 3 files
Logo Logo
Loading...