[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Metastockusers] Re: Writing code for "the first time an event happens"



PureBytes Links

Trading Reference Links

Hello,

This is my idea to resolve this (can be used as an expert symbol or 
custom indicator)

Trend := Mov(C,55,E) < Ref(Mov(C,55,E),-1);
cond1 := Trend AND Ref(Mov(C,55,E),-1) > Ref(Mov(C,55,E),-2);
EventA:=Cross(Mov(C,8,E),Mov(C,13,E));
Trend AND EventA AND BarsSince(Ref(EventA,-1)) > BarsSince(cond1);

Greetings
Klaus

--- In Metastockusers@xxxxxxxxxxxxxxx, Philip <pschmi02@xxxx> wrote:
> Greetings All,
> 
> My coding ability is still elementary and the following idea has 
me 
> stumped. Could you show me how to write it?
> 
> "While condition1 continues to be true today, today represents the 
first 
> time that Event A has occurred since condition1 began to obtain." 
More 
> specifically, I'd like to identify the first time certain events 
occur 
> during a trend.
> 
> Example 1: TRENDUP (any definition of trend) obtains today, and 
today is 
> the first time that there have been three consecutively lower 
closes (Event 
> A) *since* TRENDUP has been true.
> 
> Example 2: the EMA(55) is falling, and today is the first time 
that the 
> EMA(8) has risen above the EMA(13) (Event A) since the EMA(55) 
began to fall.
> 
> Within a relatively modest framework I'm OK with most of the 
variations on 
> the theme of Event A, but it's the *since* part that I can't put 
together.
> 
> Philip


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/