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

Re: [EquisMetaStock Group] Re: Alert Above A Line



PureBytes Links

Trading Reference Links




Metastockuser,
This is not mine, it was posted by Fredcom 
sometime back.
-------------
peri:=Input("High line periods",2,500,3);{by 
FREDCOM, 26Mai2003 --> V1.13}n:=Input("Low line 
periods",2,500,3);hic:= H>Ref(HHV(H,peri),-1) AND 
H>=Ref(HHV(H,peri),peri);y1t:=LastValue(ValueWhen( 2, hic=1, H 
));y2t:=LastValue(ValueWhen( 1, hic=1, H ));x1t:=LastValue(ValueWhen( 2, 
hic=1 , Cum(1) ));x2t:=LastValue(ValueWhen( 1, hic=1 , Cum(1) 
));{at:=(y1t-y2t)/(x1t-x2t);bt:=y1t-at*x1t;}yt:=(y1t-y2t)/(x1t-x2t)*Cum(1)+y1t-(y1t-y2t)/(x1t-x2t)*x1t; 
{yt:=at*cum(1)+bt;}e1:=H-yt;ret1:=LastValue(Cum(1)-(x1t+Int((x2t-x1t)/2)-1));seg1:=LastValue(Int((x2t-x1t)/2+Int(2*peri/5)){+peri-1});x1:=LastValue(Cum(1)-HHVBars(Ref(e1,-ret1),seg1)-ret1);y1:=LastValue(ValueWhen(1,x1=Cum(1),H));ret2:=LastValue(Cum(1)-(x2t+Int(4*peri/5)));seg2:=LastValue(Int((x2t-x1t)/2)+Int(4*peri/5));x2:=LastValue(Cum(1)-HHVBars(Ref(e1,-ret2),seg2)-ret2);y2:=LastValue(ValueWhen(1,x2=Cum(1),H));a:=(y1-y2)/(x1-x2);HiTL:=If(Cum(1)>x1t-5,(y1-y2)/(x1-x2)*Cum(1)+y1-(y1-y2)/(x1-x2)*x1,BarsSince(Cum(1)>x1t-5));loc:= 
L<Ref(LLV(L,n),-1) AND L<=Ref(LLV(L,n),n);y1t:=LastValue(ValueWhen( 2, 
loc=1, L ));y2t:=LastValue(ValueWhen( 1, loc=1, L 
));x1t:=LastValue(ValueWhen( 2, loc=1, Cum(1) 
));x2t:=LastValue(ValueWhen( 1, loc=1, Cum(1) 
));yt:=(y1t-y2t)/(x1t-x2t)*Cum(1)+y1t-(y1t-y2t)/(x1t-x2t)*x1t; 
{yt:=at*cum(1)+bt;}e1:=L-yt;ret1:=LastValue(Cum(1)-(x1t+Int((x2t-x1t)/2)-1));seg1:=LastValue(Int((x2t-x1t)/2+Int(2*n/5)){+n-1});x1:=LastValue(Cum(1)-LLVBars(Ref(e1,-ret1),seg1)-ret1);y1:=LastValue(ValueWhen(1,x1=Cum(1),L));ret2:=LastValue(Cum(1)-(x2t+Int(5*n/5)));seg2:=LastValue(Int((x2t-x1t)/2)+Int(4*n/5));x2:=LastValue(Cum(1)-LLVBars(Ref(e1,-ret2),seg2)-ret2);y2:=LastValue(ValueWhen(1,x2=Cum(1),L));{a:=(y1-y2)/(x1-x2);b:=y1-a*x1;}a:=(y1-y2)/(x1-x2);If(Cum(1)>x1t-5,(y1-y2)/(x1-x2)*Cum(1)+y1-(y1-y2)/(x1-x2)*x1,BarsSince(Cum(1)>x1t-5));HiTL
-------------
The periods can be changed according 
to your desired lookback.
Of course, in an exploration you would have to 
remove the input line and fix the look back periods.
Hope this helps.
 
DusantChief Architect<A 
href="">http://www.candlestrength.com/
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  <A title=metastockuser@xxxxxxxxx 
  href="">metastockuser 
  To: <A 
  title=equismetastock@xxxxxxxxxxxxxxx 
  href="">equismetastock@xxxxxxxxxxxxxxx 
  
  Sent: Sunday, February 29, 2004 10:47 
  PM
  Subject: [EquisMetaStock Group] Re: Alert 
  Above A Line
  I suppose what I'm really asking in it's simplest terms is: 
  "how do Icreate a straight line in metastock code so that I can use it as 
  a buyor sell line?  Ultimately I plan to define the line then let the 
  alertsystem tell me when price crosses the line.  --- In <A 
  href="">equismetastock@xxxxxxxxxxxxxxx, 
  "metastockuser"<<A 
  href="">metastockuser@x...> wrote:> I'd 
  like to use two points to define an ascending or descending line> then 
  be alerted if price closes above that line.> > I know that I can 
  drop the formula into the Expert system and when I> open the chart, the 
  alert will generate.> > But how would I define the line so that 
  I can set it up to make a> Close Greater then the line create an 
  alerts.  A flat line is easy,> just enter the price.  But an 
  ascending or decending line would have> to be defined 
somehow.







Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/equismetastock/ 
To unsubscribe from this group, send an email to:equismetastock-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.