Bruce
As you are aware I refined the the Volatility Stop indicator in SF to get rid of what I believe were flaws and one of those Adjustments were how far you allow the indicator to retreat
In TC take a look at JP with a VST 22, 4 setting as an ex pls
As you can see the stock made a new low 12/6 and has rallied eversince crossing above the VST 22,4 on 1/2
As the stock rallied from 12/6 it's volatility shrank which resulted in smaller and smaller gap between price and the indicator.
In SF we made a few adjustments and one was to only re-adjust the stop loss value when the stock makes a new high if price is above the indicator or when price is below the indicator only re-adjust the stop when the stock makes a new low
If instead the volatility would have expanded in JP in the last month that it has been rallying it woudl have caused the Stop level to back away and become wider that's why one of the other adjutments we made was to only allow the indiactor to retreat by a Max amount of ATR which I only allow Max 1. From what I see in TC this is not an issue bc the indicator never backs away. It seems when volatility expands it goes sideways but if volatility shrinks it causes the gap to become smaller which in return causes a lot of whipsaws.
I have copied the VST RealCode below for your ref
I have also shared a chart in Sf V4 with 3 types of VST indicators under VST types
The white one is the one that allows Max 1 Retreat as volatility expands
The Yellow one doesn't allow any retreat AND only re-adjust the stop on a NH or NL which is why from 12/7 a day after the NL the indicator went side ways
The Red one is something similar to what we have in TC but it doesn't seem to be exactly the same.
Can you please tell me what the diff is?
And also is there any chance to adjust the Current VST indicator to enhance it
Many thanks
'# period = UserInput.Single = 22
'# factor = UserInput.Single = 4
'# retreat = UserInput.Single = 1
'# Cumulative
Static TR As Single
Static ATR As Single
Static termRatio As Single
static Weight As Single
Static sumWeight As Single
Static extreme(1) As Single
Static tstop As Single
Static state As Boolean
If isFirstBar Then
TR = Price.High - Price.Low
termRatio = (period - 1) / period
ATR = TR
sumweight = termratio + 1
weight = 1 / sumweight
If Price.Last(-1) - System.Math.Min(Price.Low, Price.Low(-1)) < _
System.Math.Max(Price.High, Price.High(-1)) - Price.Last(-1) Then
extreme(0) = Price.Last
tstop = extreme(0) + factor * TR
extreme(1) = tstop
state = False
Else
extreme(0) = Price.Last
tstop = extreme(0) - factor * TR
extreme(1) = tstop
state = True
End If
Plot = tstop
Else
TR = (Price.High - Price.Low + _
System.Math.Abs(Price.High - Price.Last(1)) + _
System.Math.Abs(Price.Last(1) - Price.Low)) / 2
ATR = ATR * (1 - weight) + weight * TR
sumweight = sumweight * termratio + 1
weight = 1 / sumweight
If state
If Price.Last < tstop
state = False
extreme(0) = Price.Last
tstop = extreme(0) + factor * ATR
extreme(1) = tstop
End If
Else
If Price.Last > tstop
state = True
extreme(0) = Price.Last
tstop = extreme(0) - factor * ATR
extreme(1) = tstop
End If
End If
Plot = tstop
If state Then
If Price.High > Price.MaxHigh(9, 1) Then
extreme(0) = System.Math.Max(extreme(0), Price.Last)
tstop = extreme(0) - factor * ATR
extreme(1) = System.Math.Max(extreme(1), tstop)
tstop = System.Math.Max(tstop, extreme(1) - retreat * ATR)
End If
Else
If Price.Low < Price.MinLow(9, 1) Then
extreme(0) = System.Math.Min(extreme(0), Price.Last)
tstop = extreme(0) + factor * ATR
extreme(1) = System.Math.Min(extreme(1), tstop)
tstop = System.Math.Min(tstop, extreme(1) + retreat * ATR)
End If
End If
End If
|