Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 4/25/2012 Posts: 15
|
I would like to implement the following indicator formula on my tc2000 platform:
Momentum of Comparative Strength (MoCS)
MoCScombines relative strength (RS) and the MACD indicator.
MoCS replaces the closing prices used in the traditional MACD formula with a RS calculation.
The formula for MoCS is:
MoCS = (12-period EMA of (Stock/S&P 500)) - (26-period EMA (Stock/S&P 500))
Where:
-- EMA represents an exponential moving average
-- Stock represents the closing price of the stock or ETF being studied
-- S&P 500 represents the closing price of the S&P 500 index
Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I cannot think of a practical automated method of doing so in either verison of TC2000 as the Personal Criteria Formula Language does not have syntax for referencing other symbols.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 4/25/2012 Posts: 15
|
Bruce,
Thanks for your quick response.
OG
|
|
Registered User Joined: 10/7/2004 Posts: 816
|
Bruce,
How about a Stockfinder implementation with user defined periods?
Thanks
Regards
BobMc
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following RealCode Indicator:
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Momentum of Comparative Strength
'|******************************************************************
'# Cumulative
'# ShortPeriod = UserInput.Single = 12
'# LongPeriod = UserInput.Single = 26
Static Comparison As PriceScripting
Static EMA(1) As Double
Static termRatio(1) As Double
Static sumWeight(1) As Double
If isFirstBar Then
Comparison = PriceData("SP-500")
EMA(0) = 0
EMA(1) = 0
termRatio(0) = (ShortPeriod - 1) / (ShortPeriod + 1)
termRatio(1) = (LongPeriod - 1) / (LongPeriod + 1)
sumWeight(0) = 1
sumWeight(1) = 1
End If
Dim ratio As Double = Price.Last / Comparison.Last
For i As Integer = 0 To 1
Dim weight As Double = 1 / sumWeight(i)
EMA(i) = EMA(i) * (1 - weight) + weight * ratio
sumWeight(i) = sumWeight(i) * termRatio(i) + 1
Next
Plot = EMA(0) - EMA(1)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 4/25/2012 Posts: 15
|
I am relatively new to tc2000, could you please show me where I need to paste this code. Thanks BobMc, thanks again Bruce.
|
|
Registered User Joined: 10/7/2004 Posts: 816
|
Thanks Bruce
Regards
Bob Mc
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
odgarcia,
The RealCode was a response to BobMc's question about implementing the indicator in StockFinder. The RealCode will not work in TC2000.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 4/25/2012 Posts: 15
|
Thanks Bruce, one last questions: If I upgraded my Gold account to Platinum, would I then have access to Stockfinder?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
No, you would need to get a separate StockFinder subscription.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 4/25/2012 Posts: 15
|
Thanks
OG
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |