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).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Période
p=10
// Average True Range X
ATRx=AverageTrueRange[p](close)*3.0
// ATRts = ATR Trailing Stop
// Inversion de tendance
IFclosecrosses overATRtsTHEN
ATRts=close-ATRx
ELSIFclosecrosses underATRtsTHEN
ATRts=close+ATRx
ENDIF
// Cacul de l'ATRts lors de la même tendance
IFclose>ATRtsTHEN
ATRnew=close-ATRx
IFATRnew>ATRtsTHEN
ATRts=ATRnew
ENDIF
ELSIFclose<ATRtsTHEN
ATRnew=close+ATRx
IFATRnew<ATRtsTHEN
ATRts=ATRnew
ENDIF
ENDIF
returnATRtsas"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)].
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok