BardParticipant
Master
Hi there,
I coded some Volatility Stop Bands and it shows up as an indicator in the lower pane (pls see image) but not on the main price chart?
I think the coding’s correct, the idea grabbed from an article called “Maximising Risk-Adjusted gains with Trade Management – Trading Recipes” was:
“Each day divide the close by its 144-day simple moving average. The result is a relative strength indicator we can call R. Take a 21-day simple moving average of R. Plot bands at intervals 3% above and below the 21-day smoothing. If R drops below the lower band, exit the trade on tomorrow’s open.”
Any ideas?
Cheers
Bard
//R is a Relative Strength Volatility Stop Indicator
//---Settings
CloseMAPeriod = 144
RMAPeriod = 21
UpperValue = 3.0 //"Upperbands %"
LowerValue = 3.0 //"Lowerbands %"
//---end of settings
R=Close/Average[CloseMAPeriod]
RAve = Average[RMAPeriod](R)
VolStop = Rave
UpperBand = VolStop * UpperValue / 100
LowerBand = VolStop * LowerValue / 100
RETURN VolStop+UpperBand as "Volatility Upperband",VolStop-LowerBand as "Volatility Lowerband"
From your description in your post the indicator does not appear to be one that you apply to a price chart. It is meant to be a separate relative strength indicator. Just add R to your returned values to complete the indicator.
//R is a Relative Strength Volatility Stop Indicator
//---Settings
CloseMAPeriod = 144
RMAPeriod = 21
UpperValue = 3.0 //"Upperbands %"
LowerValue = 3.0 //"Lowerbands %"
//---end of settings
R=Close/Average[CloseMAPeriod]
RAve = Average[RMAPeriod](R)
VolStop = Rave
UpperBand = VolStop * UpperValue / 100
LowerBand = VolStop * LowerValue / 100
RETURN VolStop+UpperBand as "Volatility Upperband",VolStop-LowerBand as "Volatility Lowerband", R as "R"
BardParticipant
Master
Cheers @Vonasi, I guess I kind of pictured it being overlaid on price to be able to see how price interacts within the indicator but take your point: “If R drops below the lower band, exit the trade on tomorrow’s open.” If they’re typical volatility bands they could be added to price, right?
The code is a ratio of price and normalized. It does not apply on the price chart.
I have created an easier to read version by normalising the upper band as 100 and the lower as 0. Top indicator in the image is this new version with the original at the bottom.
//R is a Relative Strength Volatility Stop Indicator
//---Settings
CloseMAPeriod = 144
RMAPeriod = 21
UpperValue = 3.0 //"Upperbands %"
LowerValue = 3.0 //"Lowerbands %"
//---end of settings
R=Close/Average[CloseMAPeriod]
RAve = Average[RMAPeriod](R)
UpperBand = RAve * (1 + (UpperValue / 100))
LowerBand = RAve * (1 - (LowerValue / 100))
RValue = ((R - lowerband) / (upperband - lowerband)) * 100
RETURN 100, 0, RValue as "R"
Link to above code added to here
Snippet Link Library
BardParticipant
Master
Nice job, thanks @Vonasi.