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 |

Consequtive Days Up/Down Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Hindsight
Posted : Friday, December 22, 2006 7:10:19 PM

Registered User
Joined: 10/7/2004
Posts: 5
I've toyed for a while trying to create a custom indicator to graphically illustrate consecutive days Up/Down. Ideally, I want an indicator that rises above zero when counting consecutive days up and falls below zero when counting consecutive days down. I can do it in Excel, but I am not yet versed enough in TC to translate my Excel formulas into PCF coding. Although I can determine Up/Down days [abs(C>C1)+abs(C<C1)*-1], I can’t figure the logic to add consecutive days and have the count remain anchored to zero (I’ve come up w/all sorts of convoluted, nonsensical formulas as I’ve tried to make this work!).

I can use a modification of the above formula in the additive custom indicator tool; however, that is truly additive. If the price closes up 3 consecutive days, the result is 3. Next, if it closes down 2 consecutive days, the result is 1 (3-2=1), instead of the -2 that I want it to return. I'm sure I'm simply missing some finer point of logic/understanding to make this thing work. Can any of you seasoned TC vets help me figure this out?

I hope I’ve explained what I’m after well enough for someone to catch my vision and provide some guidance. If not, please ask clarifying questions. Any help would be greatly appreciated.


Thanks,
-Mike.
Bruce_L
Posted : Saturday, December 23, 2006 8:30:39 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Please try the following:

Select Chart Template | Add Indicator | Indicator.
- Visible: Checked
- Center Zero Line: Checked
- Plot using price scale: Unchecked
- Smoothing Average: 1
- Average Type: Doesn't matter (because the Smoothing Average is 1)
- Indicator Formula: ( - 1) * (C > C1) * (1 - (C1 > C2) * (1 - (C2 > C3) * (1 - (C3 > C4) * (1 - (C4 > C5) * (1 - (C5 > C6) * (1 - (C6 > C7) * (1 - (C7 > C8) * (1 - (C8 > C9) * (1 - (C9 > C10) * (1 - (C10 > C11) * (1 - (C11 > C12) * (1 - (C12 > C13) * (1 - (C13 > C14) * (1 - (C14 > C15) * (1 - (C15 > C16) * (1 - (C16 > C17) * (1 - (C17 > C18) * (1 - (C18 > C19) * (1 - (C19 > C20) * (1 - (C20 > C21) * (1 - (C21 > C22) * (1 - (C22 > C23) * (1 - (C23 > C24) * (1 - (C24 > C25) * (1 - (C25 > C26) * (1 - (C26 > C27) * (1 - (C27 > C28) * (1 - (C28 > C29) * (1 - (C29 > C30) * (1 - (C30 > C31) * (1 - (C31 > C32) * (1 - (C32 > C33) * (1 - (C33 > C34) * (1 - (C34 > C35) * (1 - (C35 > C36) * (1 - (C36 > C37) * (1 - (C37 > C38) * (1 - (C38 > C39) * (1 - (C39 > C40) * (1 - (C40 > C41) * (1 - (C41 > C42) * (1 - (C42 > C43) * (1 - (C43 > C44) * (1 - (C44 > C45) * (1 - (C45 > C46) * (1 - (C46 > C47) * (1 - (C47 > C48) * (1 - (C48 > C49) * (1 - (C49 > C50)))))))))))))))))))))))))))))))))))))))))))))))))) + (C < C1) * (1 - (C1 < C2) * (1 - (C2 < C3) * (1 - (C3 < C4) * (1 - (C4 < C5) * (1 - (C5 < C6) * (1 - (C6 < C7) * (1 - (C7 < C8) * (1 - (C8 < C9) * (1 - (C9 < C10) * (1 - (C10 < C11) * (1 - (C11 < C12) * (1 - (C12 < C13) * (1 - (C13 < C14) * (1 - (C14 < C15) * (1 - (C15 < C16) * (1 - (C16 < C17) * (1 - (C17 < C18) * (1 - (C18 < C19) * (1 - (C19 < C20) * (1 - (C20 < C21) * (1 - (C21 < C22) * (1 - (C22 < C23) * (1 - (C23 < C24) * (1 - (C24 < C25) * (1 - (C25 < C26) * (1 - (C26 < C27) * (1 - (C27 < C28) * (1 - (C28 < C29) * (1 - (C29 < C30) * (1 - (C30 < C31) * (1 - (C31 < C32) * (1 - (C32 < C33) * (1 - (C33 < C34) * (1 - (C34 < C35) * (1 - (C35 < C36) * (1 - (C36 < C37) * (1 - (C37 < C38) * (1 - (C38 < C39) * (1 - (C39 < C40) * (1 - (C40 < C41) * (1 - (C41 < C42) * (1 - (C42 < C43) * (1 - (C43 < C44) * (1 - (C44 < C45) * (1 - (C45 < C46) * (1 - (C46 < C47) * (1 - (C47 < C48) * (1 - (C48 < C49) * (1 - (C49 < C50))))))))))))))))))))))))))))))))))))))))))))))))))

It maxes out at 50 consecutive days. You may wish to review the following:

Plotting Custom Indicators with Examples
Handy PCF example formulas to help you learn the syntax of PCFs!

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Hindsight
Posted : Tuesday, December 26, 2006 11:02:55 PM

Registered User
Joined: 10/7/2004
Posts: 5
Bruce. Thank you for your help on this formula. It does yeild the output I'm after. I will seek to understand the logic involved. Thanks again.
Bruce_L
Posted : Wednesday, December 27, 2006 8:25:38 AM


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.