Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Calculate Range of Green Days in a Row Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
derekb1959
Posted : Monday, October 30, 2017 12:37:00 PM
Registered User
Joined: 11/21/2016
Posts: 16

Bruce,

Previously you showed me a formula for Green Days in a Row (with higher highs). Which is awesome!

TrueInRow(C > O and C > H1, 10)

Now I want to add a column to the results to sort by the stock that had the biggest overall range during those green days, ie, the percent change from the Low to the High of that number of bars. I need the Low for the first day of the green run. The syntax for L is:

L(z) -> Low Price of specified bar.

If I use the TrueInRow formula for Z, it gives me an error. z has to be a number, not a formula. So I'm stumped.

Regards,
Derek

 

Bruce_L
Posted : Monday, October 30, 2017 1:13:20 PM


Worden Trainer

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

I really wish you could put a formula in there, but it is not yet possible. You can nest a bunch of IIF() functions inside of each other however. Maybe something like the following?

IIF(C <= O OR C <= H1, 0, IIF(C1 <= O1 OR C1 <= H2, H - L, IIF(C2 <= O2 OR C2 <= H3, MAXH2 - MINL2, IIF(C3 <= O3 OR C3 <= H4, MAXH3 - MINL3, IIF(C4 <= O4 OR C4 <= H5, MAXH4 - MINL4, IIF(C5 <= O5 OR C5 <= H6, MAXH5 - MINL5, IIF(C6 <= O6 OR C6 <= H7, MAXH6 - MINL6, IIF(C7 <= O7 OR C7 <= H8, MAXH7 - MINL7, IIF(C8 <= O8 OR C8 <= H9, MAXH8 - MINL8, IIF(C9 <= O9 OR C9 <= H10, MAXH9 - MINL9, MAXH10 - MINL10))))))))))



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
derekb1959
Posted : Monday, October 30, 2017 8:07:08 PM
Registered User
Joined: 11/21/2016
Posts: 16

Bruce,

If brute force is what it takes, I'm ok with that! That was really good. Thank you!

I changed it a little to calculate the percent change from the low of the first green day. That's what I wanted to find, the biggest percent change.

IIF(C <= O OR C <= H1, 0, IIF(C1 <= O1 OR C1 <= H2, 100*(H - L)/L, IIF(C2 <= O2 OR C2 <= H3, 100*(MAXH2 - MINL2)/MINL2, IIF(C3 <= O3 OR C3 <= H4, 100*(MAXH3 - MINL3)/MINL3, IIF(C4 <= O4 OR C4 <= H5, 100*(MAXH4 - MINL4)/MINL4, IIF(C5 <= O5 OR C5 <= H6, 100*(MAXH5 - MINL5)/MINL5, IIF(C6 <= O6 OR C6 <= H7, 100*(MAXH6 - MINL6)/MINL6, IIF(C7 <= O7 OR C7 <= H8, 100*(MAXH7 - MINL7)/MINL7, IIF(C8 <= O8 OR C8 <= H9, 100*(MAXH8 - MINL8)/MINL8, IIF(C9 <= O9 OR C9 <= H10, 100*(MAXH9 - MINL9)/MINL9, 100*(MAXH10 - MINL10)/MINL10))))))))))

Bruce_L
Posted : Tuesday, October 31, 2017 8:45:08 AM


Worden Trainer

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

You can shorten this slightly by taking both the 100 * and the denominator outside the nested IIF statements.

100 * (IIF(C <= O OR C <= H1, 0, IIF(C1 <= O1 OR C1 <= H2, H / L, IIF(C2 <= O2 OR C2 <= H3, MAXH2 / MINL2, IIF(C3 <= O3 OR C3 <= H4, MAXH3 / MINL3, IIF(C4 <= O4 OR C4 <= H5, MAXH4 / MINL4, IIF(C5 <= O5 OR C5 <= H6, MAXH5 / MINL5, IIF(C6 <= O6 OR C6 <= H7, MAXH6 / MINL6, IIF(C7 <= O7 OR C7 <= H8, MAXH7 / MINL7, IIF(C8 <= O8 OR C8 <= H9, MAXH8 / MINL8, IIF(C9 <= O9 OR C9 <= H10, MAXH9 / MINL9, MAXH10 / MINL10)))))))))) - 1)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
derekb1959
Posted : Thursday, November 2, 2017 9:59:59 PM
Registered User
Joined: 11/21/2016
Posts: 16

Bruce,

You are brilliant, as always.

Thanks,
Derek

Bruce_L
Posted : Thursday, November 2, 2017 11:05:54 PM


Worden Trainer

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

You're welcome.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
raider45
Posted : Sunday, November 5, 2017 8:54:03 AM
Registered User
Joined: 9/30/2011
Posts: 788
The following PCF Formula generates numbers, I would like the modification to view the signal.
 
(C2 <= O2 OR C2 <= H3, MAXH2 / MINL2, IIF (C1 < (C3 <= O3 OR C3 <= H4, MAXH3 / MINL3, IIF (C4 <= O4 OR C4 <= H5, MAXH4 / MINL4, IIF (C5 <= O5 OR C5 <= H6, MAXH5 / MINL5, IIF <= O6 OR C6 <= H7, MAXH6 / MINL6, IIF (C7 <= O7 OR C7 <= H8, MAXH7 / MINL7, IIF (C8 <= O8 OR C8 <= H9, MAXH8 / MINL8, IIF (C9 < O9 OR C9 <= H10, MAXH9 / MINL9, MAXH10 / MINL10)))))))))) - 1)
 
Thank you and goodbye
Raider45
Bruce_L
Posted : Monday, November 6, 2017 10:02:55 AM


Worden Trainer

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

I really don't know what you want for the signal considering the formula in question. It is designed to return numbers for a reason. If you want to convert it into a signal of sort, you would need to specify what comparison you want to apply to those numbers to generate a true or false result.

I suppose if you just want a condition formula for the green day itself as defined by derekb1959 in the original question, it would be the following.

C > O and C > H1



-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.