Registered User Joined: 8/19/2008 Posts: 19
|
Is it possible to plot the crossovers of an indicator or moving average? For example, using the MACD is it possible to plot when the macd crosses the moving average? (up and down, or seperatly) in its own window. Just like to see the points and the distance, slope, etc between the points.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If you Drag and Drop the MACD and Moving Average Signal Line into the RealCode Editor, they should create something similar to the first two lines of the following RealCode Indicator:
'# MACD = indicator.MACD
'# MovA = indicator.MovAvg.2
If System.Math.Sign(MACD.Value - MovA.Value) <> _
System.Math.Sign(MACD.Value(1) - MovA.Value(1)) Then
Plot = MACD.Value(1) + ((MovA.Value(1) - MACD.Value(1)) / _
(MACD.NetChange - MovA.NetChange)) * MACD.NetChange
Else
Plot = Single.NaN
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 8/19/2008 Posts: 19
|
Thank you!
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|