## New version 18 available now

Subscription & data-feed pricing Class schedule

Margin rates Stock & option commissions

 Auto Wave Rate this Topic:
 Previous Topic · Next Topic Watch this topic · Print this topic ·
thnkbigr
 Posted : Friday, January 12, 2018 1:16:13 PM
Platinum Customer

Joined: 3/31/2006
Posts: 3,180

Bruce

Can this indicator be plotted in TC?

'# period = UserInput.Single = 14
'# factor = UserInput.Single = 2.5
'# delay = UserInput.Integer = 5
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
Static index As Integer
If isFirstBar Then
TR = Price.High - Price.Low
termRatio = (period - 1) / period
ATR = TR
sumweight = termratio + 1
weight = 1 / sumweight
index = CurrentIndex
If Price.High(-1) - System.Math.Min(Price.Low, Price.Low(-1)) < _
System.Math.Max(Price.High, Price.High(-1)) - Price.Low(-1) Then
extreme = Price.Low
tstop = System.Math.Max(Price.High, extreme + factor * ATR)
state = False
Else
extreme = Price.High
tstop = System.Math.Min(Price.Low, extreme - factor * ATR)
state = True
End If
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.Low < tstop AndAlso _
CurrentIndex - index >= delay - 1 Then
state = False
extreme = Price.Low
index = CurrentIndex
tstop = System.Math.Max(Price.High, extreme + factor * ATR)
End If
Else
If Price.High > tstop AndAlso _
CurrentIndex - index >= delay - 1 Then
state = True
extreme = Price.High
index = CurrentIndex
tstop = System.Math.Min(Price.Low, extreme - factor * ATR)
End If
End If
If state Then
If Price.High >= extreme Then
extreme = Price.High
index = CurrentIndex
End If
tstop = extreme - factor * ATR
Else
If Price.Low <= extreme Then
extreme = Price.Low
index = CurrentIndex
End If
tstop = extreme + factor * ATR
End If
End If
Plot = Single.NaN
Bruce_L
 Posted : Friday, January 12, 2018 2:01:28 PM

Worden Trainer

Joined: 10/7/2004
Posts: 64,314

I can't think of a way to do so.

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

 Forum Jump Customer Training & Support - Ask a Trainer - TC2000 version 12/18 - Ask a Trainer - TC2000 version 7 - Ask a Trainer - StockFinder 5.0 - PCFs, EasyScan and Custom Indicators General Discussions - Stock and Market Talk - TC2000 version 12 or 18 - TC2000 version 7 - StockFinder 5.0 - RealCode for StockFinder 5.0 Tutorial Videos - TC2000 version 12 tutorial videos - TC2000 version 7 tutorial videos 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.