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

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



PureBytes Links

Trading Reference Links

I've answered this question. It works. No need to respond, metarockx. Thanks.
Philip

At 06:48 PM 12/6/2003, you wrote:
>Metarockx,
>
>I have a question pertaining to the code you supplied recently. I'll paste
>the code in first:
>
>Trend := Mov(C,55,E) > Ref(Mov(C,55,E),-1);
>StartTrend := Trend AND Ref(Mov(C,55,E),-1) < Ref(Mov(C,55,E),-2);
>Trigger:= Cross(Mov(C,8,E),Mov(C,13,E));
>Signal:= Trend AND Trigger
>AND BarsSince(Ref(Trigger,-1)) > BarsSince(StartTrend);
>
>I'm clear on:
>Trend := Mov(C,55,E) > Ref(Mov(C,55,E),-1);
>
>And I think I also understand StartTrend:
>StartTrend := Trend AND Ref(Mov(C,55,E),-1) < Ref(Mov(C,55,E),-2);
>
>You have to define the event that marks the beginning of the trend because
>you will later be comparing the number of bars to have elapsed since the
>beginning of the trend to the number of bars to have elapsed since the most
>recent Trigger. In this specific case, a trend has begun when the EMA(55)
>is rising today, but it wasn't rising yesterday.
>
>What if I wanted to state the StartTrend in more general terms. Could I
>say: A trend has begun when there is trend today according to such and such
>a definition, but yesterday there was no trend according to this
>definition? Is that correct?
>
>For example, would this work?
>
>Trend: MyTrendUp; (say, couple of moving averages, or a rising ADX, or
>whatever)
>Condition1:=Ref(MyTrendUp, -1);
>StartTrend:= Trend and condition1=false;
>
>Something like that would give me more room to maneuver.
>
>Philip
>
>
>Yahoo! Groups Sponsor
>ADVERTISEMENT
><http://rd.yahoo.com/SIG=12c29gp9n/M=267637.4116730.5333196.1261774/D=egroupweb/S=1705001779:HM/EXP=1070840939/A=1853618/R=0/*http://www.netflix.com/Default?mqso=60178338&partid=4116730>
>click here
>
>[]
>
>
>To unsubscribe from this group, send an email to:
>Metastockusers-unsubscribe@xxxxxxxxxxx
>
>
>
>Your use of Yahoo! Groups is subject to the 
><http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.


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