Registered User Joined: 10/9/2006 Posts: 35
|
How do I covert a custom indicator I created in telechart to stockfinder. If it can't be converted I need help to create a moving average for 3 consecutive days pivot points and for 5 consecutive days pivot points in stockfinder. Thnaks.
3ma = (p1+p2+p3)/3 and 5ma = (p1+p2+p3+p4+p5)/5.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The easiest way would probably be to create a Pivot Point Indicator and then add Moving Averages as Child Indicators. The following RealCode Indicator should produce a Moving Pivot Point Indicator:
Plot = (Price.High(1) + Price.Low(1) + Price.Last(1)) / 3
That would be similar to what would be created by Plotting the following formula as a Custom Indicator in TeleChart:
(H1 + L1 + C1) / 3
You could build the Simple Moving Average into the RealCode Indicator using something similar to the following instead:
'# Period = UserInput.Integer = 3
Static SMA As Single
Static Old As Integer
If CurrentIndex > Period Then
SMA += (Price.High(1) + Price.Low(1) + Price.Last(1)) / 3 - _
(Price.High(Old) + Price.Low(Old) + Price.Last(Old)) / 3
Else If isFirstBar Then
SMA = 0
Old = Period + 1
Else
SMA += (Price.High(1) + Price.Low(1) + Price.Last(1)) / 3
End If
If CurrentIndex >= Period Then
Plot = SMA
Else
Plot = Single.NaN
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|