Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

MACD First Pivot Down in 5 Days Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
HarleyBD
Posted : Sunday, January 6, 2019 4:30:38 PM
Platinum Customer 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

 

 

Bruce_L
Posted : Monday, January 7, 2019 12:10:50 PM


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
HarleyBD
Posted : Monday, January 7, 2019 2:49:02 PM
Platinum Customer 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

HarleyBD
Posted : Monday, January 7, 2019 3:40:18 PM
Platinum Customer 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

Bruce_L
Posted : Monday, January 7, 2019 3:41:48 PM


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
HarleyBD
Posted : Tuesday, January 8, 2019 12:07:43 PM
Platinum Customer Platinum Customer

Joined: 6/30/2014
Posts: 60

Thanks Bruce and best regards,

HarleyBD

Bruce_L
Posted : Tuesday, January 8, 2019 12:39:19 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.