Platinum Customer
Joined: 6/30/2014 Posts: 60
|
Hi All Down There.
It's been bad weather for skiing up here, so I'm programming to stay out of trouble. The problem is that testing these programss might be the cause of dimming lights in the northeast and abetting the global warming.
I have 2 PCFs that I would like to have compressed. The first one checks for a first time pivot down in 5 days on the MACD histogram (8,18,6).
IIF(MACD(8,18)-XAVG(MACD(8,18),6)<MACD(8,18,1)-XAVG(MACD(8,18,1),6)
AND MACD(8,18,1)-XAVG(MACD(8,18,1),6)=
GREATEST((MACD(8,18,1)-XAVG(MACD(8,18,1),6)),
(MACD(8,18,2)-XAVG(MACD(8,18,2),6)),
(MACD(8,18,3)-XAVG(MACD(8,18,3),6)),
(MACD(8,18,4)-XAVG(MACD(8,18,4),6)),
(MACD(8,18,5)-XAVG(MACD(8,18,5),6)))
AND MACD(8,18)-XAVG(MACD(8,18),6)>0,4,0)
The second one checks for the first MACD histogram(8,18,6) below zero.
IIF((MACD(8,18)<XAVG(MACD(8,18),6) AND MACD(8,18,1)>=XAVG(MACD(8,18,1),6)),3,0)
Best Regards,
HarleyBD
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
So by pivot down do you mean the first time the MACD went down in x bars or just that the current bar is lower than the previous bar and the previous bar was the highest in x bars?
For the second one, you would write this as:
IIF(TrueInRow(MACD8.18 < XAVG(MACD8.18, 6), 2) = 1, 3, 0)
Or as:
IIF(TrueInRow(40 * C + 266 * XAVGC8.1 < 21 * XAVGC18.1 + 285 * XAVGC6.1, 2) = 1, 3, 0)
The first is certainly shorter and easier to alter. The requires less data to calculate and should theoretically be more efficient (but I haven't tested if this is actually the case).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Platinum Customer
Joined: 6/30/2014 Posts: 60
|
Hi Bruce,
Thanks for the corrections to first red bar (MACD histogram(8,18,6) below zero). I'll be testing those over the next several days.
As to the first pcf request, I am coding for the first time in 5 days that the MACD(8,18,6) is lower from the highest high of the MACD(8,18,6). So your discription "that the current bar is lower than the previous bar and the previous bar was the highest in x bars" is correct.
Best regards,
HarleyBD
|
Platinum Customer
Joined: 6/30/2014 Posts: 60
|
Hi Bruce,
Thanks for the corrections to first red bar (MACD histogram(8,18,6) below zero). I'll be testing those over the next several days.
As to the first pcf request, I am coding for the first time in 5 days that the MACD(8,18,6) is lower from the highest high of the MACD(8,18,6). So your discription "that the current bar is lower than the previous bar and the previous bar was the highest in x bars" is correct.
Best regards,
HarleyBD
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following.
IIF(MACD8.18 > XAVG(MACD8.18, 6) AND MACD8.18 - XAVG(MACD8.18, 6) < MACD8.18.1 - XAVG(MACD8.18.1, 6) AND MACD8.18.1 - XAVG(MACD8.18.1, 6) >= MAX(MACD8.18.2 - XAVG(MACD8.18.2, 6), 4), 4, 0)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Platinum Customer
Joined: 6/30/2014 Posts: 60
|
Thanks Bruce and best regards,
HarleyBD
|