The StopLoss indicator uses the Keltner band in several values, 50-100-150-200.
The code will calculate the average of the upper bands, then the average of the lower bands.
We then obtain an average Keltner band between these four values, which helps to smooth the band and avoid abrupt changes.
The upper band will be subtracted from the lower band, the result will then be the standard deviation of the court over an average period of time.
The indicator gives you the result in the form of a histogram.
You can use the external variable to get a higher or lower result at your convenience.
The goal is to transmit the volatility with regularity and without excess.
You also have a dotted graphical indicator, which shows you the calculated distance to the StopLoss.
On this graphical indicator, you can activate or deactivate the points if you don’t need to see them.
Sincerely yours,
//Keltner Band
MA1 = Average[50,0](TypicalPrice)
Up1 = MA1 + (Multi*Average[50,1](Range))
Down1 = MA1 - (Multi*Average[50,1](Range))
MA2 = Average[100,0](TypicalPrice)
Up2 = MA2 + (Multi*Average[100,1](Range))
Down2 = MA2 - (Multi*Average[100,1](Range))
MA3 = Average[150,0](TypicalPrice)
Up3 = MA3 + (Multi*Average[150,1](Range))
Down3 = MA3 - (Multi*Average[150,1](Range))
MA4 = Average[200,0](TypicalPrice)
Up4 = MA4 + (Multi*Average[200,1](Range))
Down4 = MA4 - (Multi*Average[200,1](Range))
Up = (Up1+Up2+Up3+Up4)/4
Down = (Down1+Down2+Down3+Down4)/4
Value = (Up-Down)
RETURN Value coloured(107,13,13,200) style (histogram)
//Indicator Graph
MA1 = Average[50,0](TypicalPrice)
Up1 = MA1 + (Multi*Average[50,1](Range))
Down1 = MA1 - (Multi*Average[50,1](Range))
MA2 = Average[100,0](TypicalPrice)
Up2 = MA2 + (Multi*Average[100,1](Range))
Down2 = MA2 - (Multi*Average[100,1](Range))
MA3 = Average[150,0](TypicalPrice)
Up3 = MA3 + (Multi*Average[150,1](Range))
Down3 = MA3 - (Multi*Average[150,1](Range))
MA4 = Average[200,0](TypicalPrice)
Up4 = MA4 + (Multi*Average[200,1](Range))
Down4 = MA4 - (Multi*Average[200,1](Range))
Up = (Up1+Up2+Up3+Up4)/4
Down = (Down1+Down2+Down3+Down4)/4
//Paramettre
LimiteDown = low-(Up-Down)
LimiteUP = high+(Up-Down)
//UP
if ActiveUp then
Ra = 107
Ga = 13
Ba = 13
Ea = 200
else
Ra = 0
Ga = 0
Ba = 0
Ea = 0
endif
//Down
if ActiveDown then
Rb = 107
Gb = 13
Bb = 13
Eb = 200
else
Rb = 0
Gb = 0
Bb = 0
Eb = 0
endif
RETURN LimiteUP coloured(Ra,Ga,Ba,Ea) style(point,3) as "LimiteUP", LimiteDown coloured(Rb,Gb,Bb,Eb) style(point,3) as "LimiteDown"