PureBytes Links
Trading Reference Links
|
And here is a more versatile version of the same indicator:
======================
WeekStart Up/Down days
======================
---8<-------------------------------------
{ Signals WeekStart Up/Down days - v2.0
For daily & intraday charts.
©Copyright 2002~2007 Jose Silva.
The grant of this license is for personal use
only - no resale or repackaging allowed.
All code remains the property of Jose Silva.
http://www.metastocktools.com }
{ User inputs }
changeUp:=Input("Minimum Up daily price change %",0,100,.00001)/100;
pdsUp:=Input("Successive Up bars",1,21,2);
changeDw:=Input("Minimum Down daily price change %",0,100,.00001)/100;
pdsDw:=Input("Successive Down bars",1,21,2);
plot:=Input("signals: [1]Up/Down bars, [2]Start of week",1,2,1);
adj:=Input("Week's start: [0]Sunday, [1]Monday",0,1,1);
{ Calendar counter engine }
leap:=Frac(Year()/4)=0 AND Frac(Year()/100)<>0
OR Frac(Year()/400)=0;
y:=Year()*365+Int(Year()/4)
-Int(Year()/100)+Int(Year()/400)-730484;
m:=
If(Month()=2,31-leap,
If(Month()=3,59,
If(Month()=4,90,
If(Month()=5,120,
If(Month()=6,151,
If(Month()=7,181,
If(Month()=8,212,
If(Month()=9,243,
If(Month()=10,273,
If(Month()=11,304,
If(Month()=12,334,
-leap)))))))))));
DayNr:=y+m+DayOfMonth();
adj:=adj+If(DayNr<1,1,2)
-(Frac(Year()/100)=0 AND Frac(Year()/400)<>0);
WkCount:=Int((DayNr-adj)/7)+(Year()>=2000);
{ Week's start signal }
WeekStart:=WkCount>Ref(WkCount,-1);
{ Condition signals }
upCond:=
Sum(C>=Ref(C,-1)*(1+changeUp),pdsUp)=pdsUp;
up:=ValueWhen(1,WeekStart,upCond)*WeekStart;
dwCond:=
Sum(C<=Ref(C,-1)*(1-changeDw),pdsDw)=pdsDw;
dw:=ValueWhen(1,WeekStart,dwCond)*WeekStart;
signals:=up-dw;
{ Plot in own window }
0;If(plot=1,signals,WeekStart)
---8<-------------------------------------
jose '-)
http://www.metastocktools.com
--- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva" <josesilva22@xxx>
wrote:
>
> Brett, try this indicator code:
>
> ===============================
> WeekEnd/Start custom conditions
> ===============================
> ---8<--------------------------------------
>
> { Signals custom WeekEnd/Start conditions.
> For daily & intraday charts.
>
> ©Copyright 2002~2007 Jose Silva.
> The grant of this license is for personal use
> only - no resale or repackaging allowed.
> All code remains the property of Jose Silva.
> http://www.metastocktools.com }
>
> { User inputs }
> plot:=Input("plot: [1]Signals, [2]Start of week",1,2,1);
> adj:=Input("Week's start: [0]Sunday, [1]Monday",0,1,1);
>
> { Calendar counter engine }
> leap:=Frac(Year()/4)=0 AND Frac(Year()/100)<>0
> OR Frac(Year()/400)=0;
> y:=Year()*365+Int(Year()/4)
> -Int(Year()/100)+Int(Year()/400)-730484;
> m:=
> If(Month()=2,31-leap,
> If(Month()=3,59,
> If(Month()=4,90,
> If(Month()=5,120,
> If(Month()=6,151,
> If(Month()=7,181,
> If(Month()=8,212,
> If(Month()=9,243,
> If(Month()=10,273,
> If(Month()=11,304,
> If(Month()=12,334,
> -leap)))))))))));
> DayNr:=y+m+DayOfMonth();
> adj:=adj+If(DayNr<1,1,2)
> -(Frac(Year()/100)=0 AND Frac(Year()/400)<>0);
> WkCount:=Int((DayNr-adj)/7)+(Year()>=2000);
>
> { Week's start signal }
> WeekStart:=WkCount>Ref(WkCount,-1);
>
> { Price down on Week's end and start days }
> signals:=WeekStart
> *ValueWhen(1,WeekStart,Sum(C<Ref(C,-1),2)=2);
>
> { Plot in own window }
> If(plot=1,signals,WeekStart)
>
> ---8<--------------------------------------
>
>
> jose '-)
> http://www.metastocktools.com
>
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, Brett Sinclair
> <brett_j_sinclair@> wrote:
>
> Can anyone help me code a condition where a stock closes down on Friday
> (last trading day of week) and then down the following Monday (first
> trading day of week)?
>
> Thank you, Brett
------------------------ Yahoo! Groups Sponsor --------------------~-->
Transfer from your equities account.
Receive up to $1,000 from GFT. Click here to learn more.
http://us.click.yahoo.com/aZttyC/X_xQAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/equismetastock/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:equismetastock-digest@xxxxxxxxxxxxxxx
mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|