Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 7/23/2006 Posts: 132
|
Here’s a MACD with a few subtle changes:
1) The price data used is (H+L+C)/3 rather than the close. I find this makes a subtle improvement in the display of divergences.
2) You can plot a second long time frame MACD line on the same chart (hidden by default).
3) The histogram bars are colored based on the relationship to the previous bar vice the standard above/below zero line coloring.
4) The color of the main MACD line is white when the slope is positive and purple when negative.
Can the following Think Script be converted to anything that telechart can use?
input ShortTimeFrameFastLength = 7 ; |
input ShortTimeFrameSlowLength = 28 ; |
input LongTimeFrameFastLength = 28 ; |
input LongTimeFrameSlowLength = 112 ; |
def fastAvg = ExpAverage(data = hlc3 , length = ShortTimeFrameFastLength); |
def slowAvg = ExpAverage(data = hlc3 , length = ShortTimeFrameSlowLength); |
plot STFValue = fastAvg - slowAvg; |
STFValue. setLineWeight ( 2 ); |
DEF STFslope = (STFValue-STFValue[ 1 ]); |
DEF STFslopeColor = if (STFslope > 0.0 , 9 , 0 ); |
STFValue.AssignValueColor( getColor (STFSlopeColor)); |
plot STFAvg = ExpAverage(data = STFValue, length = STFMACDLength); |
STFAvg.SetDefaultColor(GetColor( 8 )); |
def LfastAvg = ExpAverage(data = hlc3 , length = LongTimeFrameFastLength); |
def LslowAvg = ExpAverage(data = hlc3 , length = LongTimeFrameSlowLength); |
plot LTFValue = LfastAvg - LslowAvg; |
LTFValue. setDefaultColor ( color.green ); |
plot Diff = STFvalue - STFavg; |
diff.AssignValueColor( if diff >= diff[ 1 ] then Color.UPTICK else Color.DOWNTICK); |
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); |
Diff.SetDefaultColor(GetColor( 5 )); |
ZeroLine.SetDefaultColor(GetColor( 0 )); |
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The coloring is not possible in either TeleChart 2007 or TC2000 version 12 (it is possible in StockFinder), but the actual indicator can be plotted in either program using the same basic formulas as for a regular MACD, but done for the High, Low and Close instead of just the Close, which are then added together and divided by three.
Understanding MACD
So an Exponential MACD 7,28 could be created with a Custom PCF Indicator using the following formula:
(XAVGH7 - XAVGH28 + XAVGL7 - XAVGL28 + XAVGC7 - XAVGC28) / 3
You could then just add a 7-Period Exponential Moving Average to the Custom PCF Indicator to get the signal line.
The second Exponential MACD 28,112 would require a second Custom PCF Indicator:
(XAVGH28 - XAVGH112 + XAVGL28 - XAVGL112 + XAVGC28 - XAVGC112) / 3
As with the first MACD, just add a 5-Period Exponential Moving Average to the second Custom PCF Indicator to get its signal line.
You will probably want to Scale the Custom PCF Indicators to be centered on zero. I do not know of a way to force them into the same scale however (again, it would be possible in StockFinder).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/23/2006 Posts: 132
|
Not exactly what I was hoping for but thanks anyway.
Bernie
|
|
Registered User Joined: 10/7/2004 Posts: 816
|
Bruce,
would you please post the SF code
Thanks
BobMc
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You should be able to Open an attached Indicator directly into a running copy of StockFinder 5 (and save it from within StockFinder 5 if desired). You could also Save it to the \My Documents\StockFinder5\(Your Username)\My Indicators\ folder and then load it like you would any other Indicator (or Copy and Paste it there from wherever it Saves if you can't specify the destination directory when Saving). Attachments: Different MACD.sfIndRC - 16 KB, downloaded 688 time(s).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 816
|
Thanks Bruce
Regards
BobMc
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |