Registered User Joined: 2/17/2005 Posts: 2
|
Good morning:
I am attempting to write a PCF for a custom MACD indicator where I will get hits as the MACD line passes through in a downward direction through the trigger linewhich of course is the moving average of the MACD line. The PCF to accomplish this has three main components but to keep things simple I will only describe the first two.
Part 1. (XAVGC3-XAVGC6)> 0 AND....this works and in English assures the difference in the three day exponential and six day exponential moving average is greater than Ɔ'. Or the MACD is always greater than zero (0). Part 2. (XAVG(XAVGC3,4-XAVGC6,4)) > (XAVGC3-XAVGC6) AND....this doesn't work. In English this part of the equation is to assure the trigger line, the four (4) day exponential moving average of the MACD line is always greater > than the MACD line. I suspect some syntax violation or bogus averaging taking place. I have been working on the for three days without success.
Please advise me where the problem is.
Thank you.
Respectfully,
(removed by Moderator)
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
QUOTEPart 2. (XAVG(XAVGC3,4-XAVGC6,4)) > (XAVGC3-XAVGC6) In PCF language you cannot do an average of a fuction. The formula below will take care of this:
(XAVG(XAVGC3,4)-XAVG(XAVGC6,4)) > (XAVGC3-XAVGC6)
- Craig Here to Help!
|
|
Registered User Joined: 2/14/2005 Posts: 12
|
I have a custom Macd . It's basis is 3,22,100 . When I put this into the tele chart it doesn't look the same. When I went back to get a breakdown of its actual formula I got: var vMACD = null; function preMain() { setStudyTitle("MACD"); setCursorLabelName("MACDHist",0); setCursorLabelName("MACD",1); setCursorLabelName("MACDSig",2); setDefaultBarFgColor(Color.black,0); setDefaultBarFgColor(Color.white,1); setDefaultBarFgColor(Color.white,2); setDefaultBarThickness(3,0); setDefaultBarThickness(1,1); setDefaultBarThickness(1,2); setPlotType(PLOTTYPE_LINE); addBand(0, PS_SOLID, 2, Color.black, "0"); var fp1 = new FunctionParameter("Fast", FunctionParameter.NUMBER); fp1.setLowerLimit(1); fp1.setDefault(3); //Edit this value to set a new default var fp2 = new FunctionParameter("Slow", FunctionParameter.NUMBER); fp2.setLowerLimit(1); fp2.setDefault(22); //Edit this value to set a new default var fp3 = new FunctionParameter("Smoothing", FunctionParameter.NUMBER); fp3.setLowerLimit(1); fp3.setDefault(100); //Edit this value to set a new default var fp4 = new FunctionParameter("Source", FunctionParameter.STRING); fp4.setName("Source"); fp4.addOption("Close"); fp4.addOption("High"); fp4.addOption("Low"); fp4.addOption("Open"); fp4.addOption("HL/2"); fp4.addOption("HLC/3"); fp4.addOption("OHLC/4"); fp4.setDefault("Close"); //Edit this value to set a new default var fp5 = new FunctionParameter("TypeOsc", FunctionParameter.BOOLEAN); fp5.setName("SMA (Oscillator)"); fp5.setDefault(false); //Edit this value to set a new default var fp5 = new FunctionParameter("TypeSig", FunctionParameter.BOOLEAN); fp5.setName("SMA (Signal)"); fp5.setDefault(false); //Edit this value to set a new default } function main(Fast, Slow, Smoothing, Source, TypeOsc, TypeSig) { if (vMACD == null) vMACD = new MACDStudy(Fast, Slow, Smoothing, Source, TypeOsc, TypeSig); /********************************************* Insert your code following this text block Use vMACD.getValue(MACDStudy.HIST) and vMACD.getValue(MACDStudy.MACD) and vMACD.getValue(MACDStudy.SIGNAL) for your code **********************************************/ return new Array (vMACD.getValue(MACDStudy.HIST),vMACD.getValue(MACDStudy.MACD),vMACD.getValue(MACDStudy.SIGNAL)); } I am not a programmer so I am not able to put this into easyscan language . Can u help me ? Thanks
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
Where did this come from? Do you know what the indicator does? Is there a plain-language explanation that you can share that compelled you to start using it?
I am unable to translate the above....
What does the indicator do?
- Craig Here to Help!
|
|
Registered User Joined: 2/14/2005 Posts: 12
|
It is a Macd indicator they call T1 Macd Hist.efs. I Was using it from esignal. It seems to help signify the topping or bottoming pressure of a stock. I also have a pg for esig i could send
|
|
Registered User Joined: 2/14/2005 Posts: 12
|
also it is supposed to be a Macd histogram charting as a line rather than a vertical charting method. I could send u the attachment I have , to your email address.
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
[quote=Craig_S]QUOTE (XAVG(XAVGC3,4)-XAVG(XAVGC6,4)) > (XAVGC3-XAVGC6)
Craig,
Your PCF is correct, but TC2K does not evaluate it correctly. Write it as:
(XAVG(XAVGC4,3)-XAVG(XAVGC6,4)) > (XAVGC3-XAVGC6)
and it will be correctly evaluated.
If you wish to see just how bad the problem can be, bring up GE and:
Top Window: Custom Indicator: Plot using price scale: Check Indicator Formula: XAVG(XAVGC3,15)
and, also:
Top Window: Custom Indicator: Plot using price scale: Check Indicator Formula: XAVG(XAVGC15,3)
They should overlay one another.
You will not encounter the problem if you always write:
XAVG(XAVGCP,Q)
with
Q <= P
Of course, the problem should be fixed.
Thanks, Jim Murphy
|
|
Registered User Joined: 2/14/2005 Posts: 12
|
In reference to my previous post of 2/21 on the long winded Macd. I was wondering if it possible to have up to 5 variants in a Macd ? I see the First 3 Function Parameters are 3,22,100. respectively . Then it seems to have a 4th one that has a mixture of Open , High , low ,close for the 1st 4 options on it and a "HL/2" then a "HLC/3", "OHLC/4" and a final Default "Close" Could this be an 8-way average for the 4th Function parameter ? Then there is a 5th Function parameter as an Sma ?
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
I've looked over the code you posted above and still have no idea what it is trying to do.
Where did this come from? Where is the plain-English description of the indicator that makes you want to use it? What is it supposed to do?
I assume you read something that described the indicator before you felt you needed to use it. Share that with me and I might be able to figure out the monster.
- Craig Here to Help!
|
|
Registered User Joined: 2/14/2005 Posts: 12
|
************************************************* I received that T1 Macd from the trader below. I've been using it as an efs page formula thru esignal . But I have not been able to get in touch with her since. Alexis C. Montenegro © July 2003 Use and/or modify this code freely. If you redistribute it please include this and/or any other comment blocks and a description of any changes you make. **********************************************************/
var vMACD = null; function preMain() { setStudyTitle("MACD"); setCursorLabelName("MACDHist",0); setCursorLabelName("MACD",1); setCursorLabelName("MACDSig",2); setDefaultBarFgColor(Color.black,0); setDefaultBarFgColor(Color.white,1); setDefaultBarFgColor(Color.white,2); setDefaultBarThickness(3,0); setDefaultBarThickness(1,1); setDefaultBarThickness(1,2); setPlotType(PLOTTYPE_LINE); addBand(0, PS_SOLID, 2, Color.black, "0");
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
I wish I could help you more. I am not familiar with the language your indicator is written in so I cannot translate it. Perhaps someone else on the boards is familiar with the language and can traslate it for us
- Craig Here to Help!
|
|
Guest-1 |