BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > BullScript
  New Posts New Posts RSS Feed: Value since condition
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Value since condition

 Post Reply Post Reply
Author
Message / View First Unread Post
matt View Drop Down
Newbie
Newbie


Joined: 30 Jun 2006
Posts: 4
Post Options Post Options   Quote matt Quote  Post ReplyReply Direct Link To This Post Topic: Value since condition
    Posted: 30 Jun 2006 at 4:04pm

Hi,

Can anyone please help me with this?

I would like to show only the first value since a condition and not subsequent values, which may be separated by variable time periods. Such a formula might be written as:

  • where: condition=variable, such as CROSS(EXPR2,EXPR3)
  • and, since= any value of expr1 since nth occurence of  condition.

expr1 :=close;

expr2 := expr1(condition) and not anytrue(expr1,since(n,condition,expr1));

expr2;

Unfortunately anytrue can only accept an interger as its second parameter. Is there anyway to return :

  • any value of expr1 since condition and,
  • pass a variable to the second parameter of anytrue?

Thanks in advance.

Back to Top
chart rider View Drop Down
Regular
Regular
Avatar

Joined: 25 Sep 2004
Location: Australia
Posts: 96
Post Options Post Options   Quote chart rider Quote  Post ReplyReply Direct Link To This Post Posted: 30 Jun 2006 at 8:29pm

Matt

When I read the first line of your post, I thought I understood the question, but then the next few lines confused me.

Can you give an example of what you are trying to do.

CR

Back to Top
matt View Drop Down
Newbie
Newbie


Joined: 30 Jun 2006
Posts: 4
Post Options Post Options   Quote matt Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jul 2006 at 5:12pm


CB,

Basically I want to show a marker on the first value triggered by a set of criteria since a specific condition. The criteria (and therefore marker) may occur multiple times after the condition and at varying time periods, however i want to show only the first occurrence. Sorry for being unclear previously.

Matt
Back to Top
chart rider View Drop Down
Regular
Regular
Avatar

Joined: 25 Sep 2004
Location: Australia
Posts: 96
Post Options Post Options   Quote chart rider Quote  Post ReplyReply Direct Link To This Post Posted: 04 Jul 2006 at 5:27pm

matt

example:

1. The condition required: EMA 20 is above EMA 50

2. The criteria: Close crosses the EMA 10

The following code will identify the first time the criteria is met each time the condition is true:

condition := ma(C, 20, E) > ma(C, 50, E);

 

criteria := condition and cross(C, ma(C, 10, E));

criteriaSet := if(criteria, 1, max(prev and condition, 0));

criteriaMarker := criteriaSet and hist(criteriaSet,1)=0;

 

[linestyle=bar; width=2]

criteriaMarker;

CR

Back to Top
matt View Drop Down
Newbie
Newbie


Joined: 30 Jun 2006
Posts: 4
Post Options Post Options   Quote matt Quote  Post ReplyReply Direct Link To This Post Posted: 04 Jul 2006 at 9:54pm

 

 

Thanks CR but this will return the 1st marker only if the condition is met on consecutive bars. A condition (e.g. if the slope of a linear regression line over 3 bars[expr1] > 0 [cond2] and I wish to show only the first occurrence of this after crossing a moving average of 200 bars [cond1]) this might occur intermittently as the price varies up and down and triggering markers separated by variable no.s of bars. So the problem arises when using "hist(criteriaSet,n)=0, if condition2 occurs more than once after condition1 is met but not exactly n bars from its first occurrence then it will trigger another marker.

If I could write;

 not anytrue(cond2,barssince(n,cond1,expr1));

then the problem should be solved, however anytrue only acccepts an integer as its second variable. Maybe the only way around this problem is for some BC staff wizard to rework the anytrue code.

Anyway thanks for your time so far, if you can think of any other ideas I'd appreciate it.

Regards,

Matt

 

 

 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.69
Copyright ©2001-2010 Web Wiz