Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

volatility stop indicator Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
pianopilot
Posted : Thursday, June 4, 2015 3:51:57 PM
Registered User
Joined: 5/27/2011
Posts: 45

Bruce,

In earlier topics you give information for a volitility stop indicator. You give the formula July 13 2009. However I have tried to drop the formula following the inherits line and errors appear.  Would you please give me the formula where it can be placed immediately below the "inherits" line in the Class Tab.

Thanks,

Ed

Bruce_L
Posted : Thursday, June 4, 2015 4:08:07 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

If you are talking about my Monday, July 13, 2009 12:55:03 PM ET post in the My volatility stop in SF topic, it is designed to be pasted into the Code tab of a RealCode Indicator and not into the Class tab below the Inherits line.

Also note that first line would need to be replaced as it is an example of applying the Volatility Stop to another indicator instead of applying it to price.


'# MI = indicator.MyIndicator

You would drag and drop the indicator into the RealCode Editor and then set the variable name to MI instead of whatever gets assigned so the rest of the RealCode can access it.

If you want RealCode for a Volatility Stop calculated on price, I'd probably just use the RealCode from the first post in the topic in the Code tab.

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:My Indicator
'|******************************************************************
'# period = UserInput.Single = 14
'# factor = UserInput.Single = 3
'#Cumulative
Static TR As Single
Static ATR As Single
Static termRatio As Single
static Weight As Single
Static sumWeight As Single
Static extreme 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 = Price.Last
		tstop = extreme + factor * TR
		state = False
	Else
		extreme = Price.Last
		tstop = extreme - factor * TR
		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 = Price.Last
			tstop = extreme + factor * ATR
		End If
	Else
		If Price.Last > tstop
			state = True
			extreme = Price.Last
			tstop = extreme - factor * ATR
		End If
	End If
	Plot = tstop
	If state
		extreme = System.Math.Max(extreme, Price.Last)
		tstop = extreme - factor * ATR
	Else
		extreme = System.Math.Min(extreme, Price.Last)
		tstop = extreme + factor * ATR
	End If
End If


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
pianopilot
Posted : Thursday, June 4, 2015 5:05:54 PM
Registered User
Joined: 5/27/2011
Posts: 45

Bruce,

Thanks.. Is Period the look back period in time segments as given on the Chart, and the Factor the multiples of ATR?

Thanks, Ed

Bruce_L
Posted : Thursday, June 4, 2015 5:37:32 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Factor is the multiple of ATR.

Period is very similar to the looback in time segments, but it is using Wilder's Smoothing instead of something like a simple moving average, so a period of 14 doesn't mean it is looking at 14 bars. The idea of increasing the period to increase the lookback is quite similar however.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
pianopilot
Posted : Friday, June 5, 2015 2:57:37 AM
Registered User
Joined: 5/27/2011
Posts: 45

Bruce,

Thanks for the information.  The indicator works great, and behaves similar to Wilder's PSAR.

Thanks, Ed

Bruce_L
Posted : Friday, June 5, 2015 9:28:47 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.