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 |

SinceTrue(b,x) customize return value for not true in period Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
carlson
Posted : Sunday, October 21, 2018 7:35:34 AM
Registered User
Joined: 5/5/2015
Posts: 20
SinceTrue(b, x) -> returns -1 if Boolean Formula was not true in period, or bars since it was true, 0 being the current bar, and period-1 the max it will return
 
For not true in period, I would like to replace -1 with max return value.
 
This is the best I can think of:
 
(SinceTrue(b,x) = -1) * (x-1)
-
(SinceTrue(b,x) > -1) * SinceTrue(b,x)
 
It seems kind of long. Is there a more efficient way to accomplish the same?
 
thank you
 
Bruce_L
Posted : Monday, October 22, 2018 10:02:01 AM


Worden Trainer

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

Use TrueInRow() with NOT() instead.

TrueInRow(NOT(b), x)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
carlson
Posted : Tuesday, October 23, 2018 12:26:18 AM
Registered User
Joined: 5/5/2015
Posts: 20

Brilliant!

Thank you.

Bruce_L
Posted : Tuesday, October 23, 2018 9:28:58 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.