========
Contents
========
DayCount.txt - Calendar Day counter
Roy-100.txt - Daily ADX
Roy-101.txt - Daily ATR
Roy-102.txt - Daily BB Bottom
Roy-103.txt - Daily BB Top
Roy-104.txt - Daily Bollinger Bands
Roy-105.txt - Daily Close
Roy-106.txt - Daily CMO
Roy-107.txt - Daily Double Smoothed Stochastic
Roy-108.txt - Daily EMA - Close
Roy-109.txt - Daily Fractal Down
Roy-110.txt - Daily Fractal Up
Roy-111.txt - Daily Linear Regression Slope
Roy-112.txt - Daily Linear Regression
Roy-113.txt - Daily MACD - Close
Roy-114.txt - Daily Momentum
Roy-115.txt - Daily OHLC
Roy-116.txt - Daily RSI - Close
Roy-117.txt - Daily SMA - Close
Roy-118.txt - Daily SMA - High
Roy-119.txt - Daily SMA - Low
Roy-120.txt - Daily SMA - Open
Roy-121.txt - Daily Standard Deviation
Roy-122.txt - Daily Stochastic Oscillator EMA
Roy-123.txt - Daily Stochastic Oscillator SMA
Roy-124.txt - Daily Timing Signals
Roy-125.txt - Daily Volume
Roy-126.txt - Daily Wilders - Close
MetaStock -> Tools -> Indicator Builder -> New
Copy and paste formulae below.
====================
Calendar Day counter
====================
The "Calendar Day counter" is a prerequisite for all
of the following daily indicators.
---8<---------------------------
{Day counter from 1/1/0001, Gregorian calendar}
{Count is independent of any missing chart data}
{©Copyright 2003-2004 Jose Silva}
{http://www.metastocktools.com}
limit:=Input("count calendar days from year",1,2100,2000);
LimLeap:=Frac(limit/4)=0 AND Frac(limit/100)<>0
OR Frac(limit/400)=0;
NoCount:=limit*365+Int(limit/4)
-Int(limit/100)+Int(limit/400)-LimLeap;
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)-NoCount;
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();
DayNr
---8<---------------------------
==========
Daily ADX
==========
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily ADX" plots a daily ADX signal on any intraday chart with
sufficient historical data. The construction is not quite true to the
standard MetaStock "Directional Movement ADX" indicator and therefore
the plot values also will differ slightly.
---8<---------------------------
{Daily ADX}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily ADX Periods",1,99,10); X:=1/N;
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Ho:=HighestSince(1,M,H);
Ho:=ValueWhen(1,J,If(J=1,Ho,ValueWhen(2-G,1,Ho)));
Lo:=LowestSince(1,M,L);
Lo:=ValueWhen(1,J,If(J=1,Lo,ValueWhen(2-G,1,Lo)));
Ci:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ho:=ValueWhen(1,Ho>0,Ho); Hi:=ValueWhen(2,J,Ho);
Lo:=ValueWhen(1,Lo>0,Lo); Li:=ValueWhen(2,J,Lo);
{Ci:=ValueWhen(1,Ci>0,Ci);}
Ci:=ValueWhen(2,J AND Ci>0,Ci);
Pdm:=If(Ho>Hi AND Lo>=Li,Ho-Hi,If(Ho>Hi AND
Lo
(Li-Lo),Ho-Hi,0));
Mdm:=If(LoHi AND
Lo0)0)*R)/N, ValueWhen(1,J,PREV)*(1-X)+R*X);
I:=If(Cum(J>0)0)*Pdm)/N, ValueWhen(1,J,PREV)*(1-X)+Pdm*X);
I:=100*I/A;
M:=If(Cum(J>0)0)*Mdm)/N, ValueWhen(1,J,PREV)*(1-X)+Mdm*X);
M:=100*M/A;
M:=Abs(I-M)/(I+M);
F:=ValueWhen(1,J,PREV)*(1-X)+M*X;
X:=100*If(ValueWhen(N+1,J,F)>0,F,F);
X;
---8<---------------------------
==========
Daily ATR
==========
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily ATR" plots a daily ATR signal on any intraday chart with
sufficient historical data.
---8<---------------------------
{Daily ATR}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily ATR Periods",1,99,10); X:=1/N;
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Ho:=HighestSince(1,M,H);
Ho:=ValueWhen(1,J,If(J=1,Ho,ValueWhen(2-G,1,Ho)));
Lo:=LowestSince(1,M,L);
Lo:=ValueWhen(1,J,If(J=1,Lo,ValueWhen(2-G,1,Lo)));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ho:=ValueWhen(1,Ho>0,Ho); Hi:=ValueWhen(2,J,Ho);
Lo:=ValueWhen(1,Lo>0,Lo); Li:=ValueWhen(2,J,Lo);
K:=ValueWhen(1,K>0,K); Ci:=ValueWhen(2,J,K);
R:=Max(Max(Abs(Ci-Lo),Abs(Ci-Ho)),Ho-Lo);
A:=If(Cum(J>0)0)*R)/N, ValueWhen(1,J,PREV)*(1-X)+R*X);
If(ValueWhen(N+1,J,A)>0,A,A);
---8<---------------------------
================
Daily BB Bottom
================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily BB Bottom" plots a daily Bollinger Band Bottom signal on any
intraday chart with sufficient historical data.
---8<---------------------------
{Daily BB Bottom}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily BB Bottom Periods",1,30,20);
D:=Input("Standard Deviations",0,9,1);
Ma:=Input("Base Average, 0=SMA 1=EMA",0,1,0);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
K:=ValueWhen(1,K>0,K); Y:=2/(N+1);
M:=(Cum(If(J,K,0))-ValueWhen(N+1,J,Cum(If(J,K,0))))/N;
Me:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);
N1:=LastValue((N>10)*10); N2:=LastValue((N>20)*20);
X:=Power(M-ValueWhen(1,J,K),2)+
(N>1)*Power(M-ValueWhen(2,J,K),2)+
(N>2)*Power(M-ValueWhen(3,J,K),2)+
(N>3)*Power(M-ValueWhen(4,J,K),2)+
(N>4)*Power(M-ValueWhen(5,J,K),2)+
(N>5)*Power(M-ValueWhen(6,J,K),2)+
(N>6)*Power(M-ValueWhen(7,J,K),2)+
(N>7)*Power(M-ValueWhen(8,J,K),2)+
(N>8)*Power(M-ValueWhen(9,J,K),2)+
(N>9)*Power(M-ValueWhen(10,J,K),2)+
(N>10)*Power(M-ValueWhen(N1+1,J,K),2)+
(N>11)*Power(M-ValueWhen(N1+2,J,K),2)+
(N>12)*Power(M-ValueWhen(N1+3,J,K),2)+
(N>13)*Power(M-ValueWhen(N1+4,J,K),2)+
(N>14)*Power(M-ValueWhen(N1+5,J,K),2)+
(N>15)*Power(M-ValueWhen(N1+6,J,K),2)+
(N>16)*Power(M-ValueWhen(N1+7,J,K),2)+
(N>17)*Power(M-ValueWhen(N1+8,J,K),2)+
(N>18)*Power(M-ValueWhen(N1+9,J,K),2)+
(N>19)*Power(M-ValueWhen(N1+10,J,K),2)+
(N>20)*Power(M-ValueWhen(N2+1,J,K),2)+
(N>21)*Power(M-ValueWhen(N2+2,J,K),2)+
(N>22)*Power(M-ValueWhen(N2+3,J,K),2)+
(N>23)*Power(M-ValueWhen(N2+4,J,K),2)+
(N>24)*Power(M-ValueWhen(N2+5,J,K),2)+
(N>25)*Power(M-ValueWhen(N2+6,J,K),2)+
(N>26)*Power(M-ValueWhen(N2+7,J,K),2)+
(N>27)*Power(M-ValueWhen(N2+8,J,K),2)+
(N>28)*Power(M-ValueWhen(N2+9,J,K),2)+
(N>29)*Power(M-ValueWhen(N2+10,J,K),2);
Ma:=If(Ma,Me,M); Sd:=D*Sqrt(X/N);
Ma-Sd;
---8<---------------------------
=============
Daily BB Top
=============
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily BB Top" plots a daily Bollinger Band Top signal on any daily
chart with sufficient historical data.
---8<---------------------------
{Daily BB Top}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily BB Top Periods",1,30,20);
D:=Input("Standard Deviations",0,9,1);
Ma:=Input("Base Average, 0=SMA 1=EMA",0,1,0);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
K:=ValueWhen(1,K>0,K); Y:=2/(N+1);
M:=(Cum(If(J,K,0))-ValueWhen(N+1,J,Cum(If(J,K,0))))/N;
Me:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);
N1:=LastValue((N>10)*10); N2:=LastValue((N>20)*20);
X:=Power(M-ValueWhen(1,J,K),2)+
(N>1)*Power(M-ValueWhen(2,J,K),2)+
(N>2)*Power(M-ValueWhen(3,J,K),2)+
(N>3)*Power(M-ValueWhen(4,J,K),2)+
(N>4)*Power(M-ValueWhen(5,J,K),2)+
(N>5)*Power(M-ValueWhen(6,J,K),2)+
(N>6)*Power(M-ValueWhen(7,J,K),2)+
(N>7)*Power(M-ValueWhen(8,J,K),2)+
(N>8)*Power(M-ValueWhen(9,J,K),2)+
(N>9)*Power(M-ValueWhen(10,J,K),2)+
(N>10)*Power(M-ValueWhen(N1+1,J,K),2)+
(N>11)*Power(M-ValueWhen(N1+2,J,K),2)+
(N>12)*Power(M-ValueWhen(N1+3,J,K),2)+
(N>13)*Power(M-ValueWhen(N1+4,J,K),2)+
(N>14)*Power(M-ValueWhen(N1+5,J,K),2)+
(N>15)*Power(M-ValueWhen(N1+6,J,K),2)+
(N>16)*Power(M-ValueWhen(N1+7,J,K),2)+
(N>17)*Power(M-ValueWhen(N1+8,J,K),2)+
(N>18)*Power(M-ValueWhen(N1+9,J,K),2)+
(N>19)*Power(M-ValueWhen(N1+10,J,K),2)+
(N>20)*Power(M-ValueWhen(N2+1,J,K),2)+
(N>21)*Power(M-ValueWhen(N2+2,J,K),2)+
(N>22)*Power(M-ValueWhen(N2+3,J,K),2)+
(N>23)*Power(M-ValueWhen(N2+4,J,K),2)+
(N>24)*Power(M-ValueWhen(N2+5,J,K),2)+
(N>25)*Power(M-ValueWhen(N2+6,J,K),2)+
(N>26)*Power(M-ValueWhen(N2+7,J,K),2)+
(N>27)*Power(M-ValueWhen(N2+8,J,K),2)+
(N>28)*Power(M-ValueWhen(N2+9,J,K),2)+
(N>29)*Power(M-ValueWhen(N2+10,J,K),2);
Ma:=If(Ma,Me,M); Sd:=D*Sqrt(X/N);
Ma+Sd;
---8<---------------------------
======================
Daily Bollinger Bands
======================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Bollinger Bands" plots daily Bollinger Band signals on any daily
chart with sufficient historical data.
---8<---------------------------
{Daily Bollinger Bands}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily Bollinger Band Periods",1,30,20);
D:=Input("Standard Deviations",0,9,2);
Ma:=Input("Base Average, 0=SMA 1=EMA",0,1,0);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
K:=ValueWhen(1,K>0,K); Y:=2/(N+1);
M:=(Cum(If(J,K,0))-ValueWhen(N+1,J,Cum(If(J,K,0))))/N;
Me:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);
N1:=LastValue((N>10)*10);
N2:=LastValue((N>20)*20);
X:=Power(M-ValueWhen(1,J,K),2)+
(N>1)*Power(M-ValueWhen(2,J,K),2)+
(N>2)*Power(M-ValueWhen(3,J,K),2)+
(N>3)*Power(M-ValueWhen(4,J,K),2)+
(N>4)*Power(M-ValueWhen(5,J,K),2)+
(N>5)*Power(M-ValueWhen(6,J,K),2)+
(N>6)*Power(M-ValueWhen(7,J,K),2)+
(N>7)*Power(M-ValueWhen(8,J,K),2)+
(N>8)*Power(M-ValueWhen(9,J,K),2)+
(N>9)*Power(M-ValueWhen(10,J,K),2)+
(N>10)*Power(M-ValueWhen(N1+1,J,K),2)+
(N>11)*Power(M-ValueWhen(N1+2,J,K),2)+
(N>12)*Power(M-ValueWhen(N1+3,J,K),2)+
(N>13)*Power(M-ValueWhen(N1+4,J,K),2)+
(N>14)*Power(M-ValueWhen(N1+5,J,K),2)+
(N>15)*Power(M-ValueWhen(N1+6,J,K),2)+
(N>16)*Power(M-ValueWhen(N1+7,J,K),2)+
(N>17)*Power(M-ValueWhen(N1+8,J,K),2)+
(N>18)*Power(M-ValueWhen(N1+9,J,K),2)+
(N>19)*Power(M-ValueWhen(N1+10,J,K),2)+
(N>20)*Power(M-ValueWhen(N2+1,J,K),2)+
(N>21)*Power(M-ValueWhen(N2+2,J,K),2)+
(N>22)*Power(M-ValueWhen(N2+3,J,K),2)+
(N>23)*Power(M-ValueWhen(N2+4,J,K),2)+
(N>24)*Power(M-ValueWhen(N2+5,J,K),2)+
(N>25)*Power(M-ValueWhen(N2+6,J,K),2)+
(N>26)*Power(M-ValueWhen(N2+7,J,K),2)+
(N>27)*Power(M-ValueWhen(N2+8,J,K),2)+
(N>28)*Power(M-ValueWhen(N2+9,J,K),2)+
(N>29)*Power(M-ValueWhen(N2+10,J,K),2);
Ma:=If(Ma,Me,M); Sd:=D*Sqrt(X/N);
Ma; {moving average}
Ma+Sd; {Bollinger Band Top}
Ma-Sd; {Bollinger Band Bottom}
---8<---------------------------
============
Daily Close
============
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Close" plots a daily closing price on any intraday chart with
sufficient historical data.
---8<---------------------------
{Daily Close}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
K:=ValueWhen(1,K>0,K);
K;
---8<---------------------------
==========
Daily CMO
==========
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily CMO" plots a daily Chande Momentum Oscillator signal on
any intraday chart with sufficient historical data.
---8<---------------------------
{Daily CMO}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily CMO Periods ",1,99,10);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
K:=ValueWhen(1,K>0,K);
K1:=ValueWhen(2,J>0,K);
Uw:=If(K>K1,K-K1,0);
Dw:=If(K0,Uw,0))-ValueWhen(N+1,J,Cum(If(J,Uw,0)));
D:=Cum(If(J>0,Dw,0))-ValueWhen(N+1,J,Cum(If(J,Dw,0)));
100*(U-D)/(U+D);
---8<---------------------------
=================================
Daily Double Smoothed Stochastic
=================================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Double Smoothed Stochastic" plots a daily double smoothed
Stochastic Oscillator signal on any intraday chart with sufficient
historical data.
---8<---------------------------
{Daily Double Smoothed Stochastic}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily Double Smoothed Stochastic Periods",2,99,10);
R:=Input("Smoothing Periods",1,9,3); R:=2/(R+1);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2-G,1,Hw)));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2-G,1,Lw)));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ls:=LowestSince(N,J,Lw);
Hs:=HighestSince(N,J,Hw);
P0:=((K-Ls)/(Hs-Ls))*100;
P1:=ValueWhen(1,J,PREV)*(1-R)+P0*R;
Lp:=LowestSince(N,J,P1);
Hp:=HighestSince(N,J,P1);
P2:=((P1-Lp)/(Hp-Lp))*100;
ValueWhen(1,J,PREV)*(1-R)+P2*R;
---8<---------------------------
==================
Daily EMA - Close
==================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily EMA - Close" plots a daily exponential moving average of the
daily closing price on any intraday chart with sufficient historical data.
---8<---------------------------
{Daily EMA - Close}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily EMA - Close Periods",1,99,10);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
N:=2/(1+N);
If(Cum(G+J>0)<=2-G,K, ValueWhen(1,J,PREV)*(1-N)+K*N);
---8<---------------------------
===================
Daily Fractal Down
===================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Fractal Down" plots a daily fractal down signal on any daily
chart with sufficient historical data.
---8<---------------------------
{Daily Fractal Down}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
L0:=LowestSince(1,M,L);
L0:=ValueWhen(1,J,If(J=1,L0,ValueWhen(2-G,1,L0)));
L1:=ValueWhen(2,J,L0);
L2:=ValueWhen(3,J,L0);
L3:=ValueWhen(4,J,L0);
L4:=ValueWhen(5,J,L0);
L5:=ValueWhen(6,J,L0);
Single:=L2
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
H0:=HighestSince(1,M,H);
H0:=ValueWhen(1,J,If(J=1,H0,ValueWhen(2-G,1,H0)));
H1:=ValueWhen(2,J,H0);
H2:=ValueWhen(3,J,H0);
H3:=ValueWhen(4,J,H0);
H4:=ValueWhen(5,J,H0);
H5:=ValueWhen(6,J,H0);
Single:=H2>H4 AND H2>H3 AND H2>H1;
Double:=H2>H5 AND H2>H4 AND H2=H3 AND H2>H1;
ValueWhen(1,Single OR Double,H2);
---8<---------------------------
==============================
Daily Linear Regression Slope
==============================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Linear Regression Slope" plots a daily Linear Regression Slope
signal on any intraday chart with sufficient historical data.
---8<---------------------------
{Daily Linear Regression Slope}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
D:=Input("Daily Linear Regression Slope Periods",1,99,10);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
K:=ValueWhen(1,K>0,K);
M:=Cum(J>0)*K;
M:=Cum(M*(J>0))-ValueWhen(D+1,J>0,Cum(M*(J>0)));
N:=Cum(J>0);
N:=Cum(N*(J>0))-ValueWhen(D+1,J>0,Cum(N*(J>0)));
X:=Cum(K*(J>0));
X:=X-ValueWhen(D+1,J>0,X);
Y:=Cum((J>0)*Pwr(Cum(J>0),2));
Y:=Y-ValueWhen(D+1,J>0,Y);
(D*M-N*X)/(D*Y-Pwr(N,2));
---8<---------------------------
========================
Daily Linear Regression
========================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Linear Regression" plots a daily Linear Regression signal on any
intraday chart with sufficient historical data.
---8<---------------------------
{Daily Linear Regression}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily Linear Regression Periods",1,99,10);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
K:=ValueWhen(1,K>0,K);
A:=Cum(J>0);
B:=Cum(A*K*(J>0)); B:=B-ValueWhen(N+1,J,B);
D:=Cum(A*(J>0)); D:=D-ValueWhen(N+1,J,D);
F:=Cum(K*(J>0)); F:=F-ValueWhen(N+1,J,F);
G:=Cum(Pwr(A,2)*(J>0)); G:=G-ValueWhen(N+1,J,G);
I:=Pwr(D,2);
M:=Cum(K*(J>0)); M:=(M-ValueWhen(N+1,J,M))/N;
Q:=Cum(A*(J>0)); Q:=(Q-ValueWhen(N+1,J,Q))/N;
(N*B-D*F)/(N*G-I)*A+(M-Q*(N*B-D*F)/(N*G-I));
---8<---------------------------
===================
Daily MACD - Close
===================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily MACD - Close" plots daily MACD and signal values on any daily
chart with sufficient historical data.
---8<---------------------------
{Daily MACD - Close}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily MACD Signal Periods",1,19,9);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
K:=ValueWhen(1,K>0,K);
X:=0.15; Y:=0.075; N:=2/(N+1);
X:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-X)+K*X);
Y:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);
R:=X-Y;
Z:=If(Cum(J>0)=1,R,ValueWhen(1,J,PREV)*(1-N)+R*N);
R; {MACD}
Z; {Signal}
---8<---------------------------
===============
Daily Momentum
===============
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Momentum" plots a daily momentum signal on any intraday chart with
sufficient historical data.
---8<---------------------------
{Daily Momentum}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily Momentum Periods",1,99,10);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
K:=ValueWhen(1,K>0,K);
100*ValueWhen(1,J,K)/ValueWhen(N+1,J,K);
---8<---------------------------
===========
Daily OHLC
===========
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily OHLC" plots daily prices on any intraday chart with sufficient
historical data.
---8<---------------------------
{Daily OHLC}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2-G,1,Hw)));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2-G,1,Lw)));
Cw:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ow:=ValueWhen(1,J,If(J=1,ValueWhen(1,M,O),
ValueWhen(2-G,1,ValueWhen(1,M,O))));
Ow:=ValueWhen(1,Ow>0,Ow);
Hw:=ValueWhen(1,Hw>0,Hw);
Lw:=ValueWhen(1,Lw>0,Lw);
Cw:=ValueWhen(1,Cw>0,Cw);
Ow; Hw; Lw; Cw;
---8<---------------------------
==================
Daily RSI - Close
==================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily RSI - Close" plots a daily RSI signal of the closing price on any
intraday chart with sufficient historical data.
---8<---------------------------
{Daily RSI - Close}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily RSI - Close Periods",1,99,10); Pc:=1/N;
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
K:=ValueWhen(1,K>0,K);
Ua:=ValueWhen(1,J>0,K); Da:=ValueWhen(2,J>0,K);
Ub:=If(Ua>Da,Ua-Da,0); Db:=If(Ua0)=N+1,Cum(If(J AND Cum(1)<>1,Ub,
0))/N,ValueWhen(1,J>0,PREV)*(1-Pc)+Ub*Pc);
D:=If(Cum(J>0)=N+1,Cum(If(J AND Cum(1)<>1,Db,
0))/N,ValueWhen(1,J>0,PREV)*(1-Pc)+Db*Pc);
D:=If(D=0,U,D);
D:=ValueWhen(1,D>0,D);
R:=100-(100/(1+(U/D)));
If(ValueWhen(N+1,J,R)>0,R,R);
---8<---------------------------
==================
Daily SMA - Close
==================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily SMA - Close" plots a simple moving average of the daily closing
price on any intraday chart with sufficient historical data.
---8<---------------------------
{Daily SMA - Close}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily SMA - Close Periods",1,99,10);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
X:=Cum((J>0)*K);
(X-ValueWhen(N+1,J,X))/N;
---8<---------------------------
==================
Daily SMA - High
==================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily SMA - High" plots a simple moving average of the daily high price
on any intraday chart with sufficient historical data.
---8<---------------------------
{Daily SMA - High}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily SMA - High Periods",1,99,10);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=HighestSince(1,M,H);
K:=ValueWhen(1,J,If(J=1,K,ValueWhen(2-G,1,K)));
K:=ValueWhen(1,K>0,K);
X:=Cum((J>0)*K);
(X-ValueWhen(N+1,J,X))/N;
---8<---------------------------
================
Daily SMA - Low
================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily SMA - Low" plots a simple moving average of the daily low price
on any intraday chart with sufficient historical data.
---8<---------------------------
{Daily SMA - Low}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily SMA - Low Periods",1,99,10);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=LowestSince(1,M,L);
K:=ValueWhen(1,J,If(J=1,K,ValueWhen(2-G,1,K)));
K:=ValueWhen(1,K>0,K);
X:=Cum((J>0)*K);
(X-ValueWhen(N+1,J,X))/N;
---8<---------------------------
=================
Daily SMA - Open
=================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily SMA - Open" plots a simple moving average of the daily open price
on any intraday chart with sufficient historical data.
---8<---------------------------
{Daily SMA - Open}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily SMA - Open Periods",1,99,10);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,ValueWhen(1,M,O),
ValueWhen(2-G,1,ValueWhen(1,M,O))));
K:=ValueWhen(1,K>0,K);
X:=Cum((J>0)*K);
(X-ValueWhen(N+1,J,X))/N;
---8<---------------------------
=========================
Daily Standard Deviation
=========================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Standard Deviation" plots the daily standard deviation (or
multiple) signal on any intraday chart with sufficient historical data.
---8<---------------------------
{Daily Standard Deviation}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily Standard Deviation Periods",2,26,10);
X:=Input("Deviations",0,9,2);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
M:=(Cum(If(J,K,0))-ValueWhen(N+1,J,Cum(If(J,K,0))))/N;
N1:=LastValue((N>5)*5); N2:=LastValue((N>10)*10);
N3:=LastValue((N>15)*15); N4:=LastValue((N>20)*20);
Y:=Power(M-ValueWhen(1,J,K),2)+
Power(M-ValueWhen(2,J,K),2)+
(N>2)*Power(M-ValueWhen(3,J,K),2)+
(N>3)*Power(M-ValueWhen(4,J,K),2)+
(N>4)*Power(M-ValueWhen(5,J,K),2)+
(N>5)*Power(M-ValueWhen(N1+1,J,K),2)+
(N>6)*Power(M-ValueWhen(N1+2,J,K),2)+
(N>7)*Power(M-ValueWhen(N1+3,J,K),2)+
(N>8)*Power(M-ValueWhen(N1+4,J,K),2)+
(N>9)*Power(M-ValueWhen(N1+5,J,K),2)+
(N>10)*Power(M-ValueWhen(N2+1,J,K),2)+
(N>11)*Power(M-ValueWhen(N2+2,J,K),2)+
(N>12)*Power(M-ValueWhen(N2+3,J,K),2)+
(N>13)*Power(M-ValueWhen(N2+4,J,K),2)+
(N>14)*Power(M-ValueWhen(N2+5,J,K),2)+
(N>15)*Power(M-ValueWhen(N3+1,J,K),2)+
(N>16)*Power(M-ValueWhen(N3+2,J,K),2)+
(N>17)*Power(M-ValueWhen(N3+3,J,K),2)+
(N>18)*Power(M-ValueWhen(N3+4,J,K),2)+
(N>19)*Power(M-ValueWhen(N3+5,J,K),2)+
(N>20)*Power(M-ValueWhen(N4+1,J,K),2)+
(N>21)*Power(M-ValueWhen(N4+2,J,K),2)+
(N>22)*Power(M-ValueWhen(N4+3,J,K),2)+
(N>23)*Power(M-ValueWhen(N4+4,J,K),2)+
(N>24)*Power(M-ValueWhen(N4+5,J,K),2)+
(N>25)*Power(M-ValueWhen(N4+6,J,K),2);
X*Sqrt(Y/N);
---8<---------------------------
================================
Daily Stochastic Oscillator EMA
================================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Stochastic Oscillator EMA" plots a daily stochastic oscillator
and signal with EMA smoothing on any intraday chart with sufficient
historical data.
---8<---------------------------
{Daily Stochastic Osc EMA}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
K:=Input("Daily Stochastic Oscillator %K Periods",1,99,5);
N:=Input("%K Slowing Periods" ,1,99,3);
R:=Input("%D EMA Periods",1,99,3);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2,1,Hw)));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2,1,Lw)));
Cw:=ValueWhen(1,J,If(J=1,C,ValueWhen(2,1,C)));
Hw:=ValueWhen(1,Hw>0,Hw);
Lw:=ValueWhen(1,Lw>0,Lw);
Cw:=ValueWhen(1,Cw>0,Cw);
Z:=Cum((Cw-LowestSince(K,J,Lw))*(J>0));
Z:=Z-ValueWhen(N+1,J,Z);
I:=Cum((HighestSince(K,J,Hw)- LowestSince(K,J,Lw))*(J>0));
I:=I-ValueWhen(N+1,J,I);
I:=ValueWhen(1,Cum(I>0)>0,I);
X:=100*Z/I; A:=2/(1+R);
X:=ValueWhen(1,Cum(J>0)>=K+N,X);
Y:=ValueWhen(1,J,PREV)*(1-A)+X*A;
Y:=ValueWhen(1,Cum(J>0)>=K+N+R,Y);
X; {%K}
Y; {%D}
---8<---------------------------
================================
Daily Stochastic Oscillator SMA
================================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Stochastic Oscillator SMA" plots a daily stochastic oscillator
and signal with SMA smoothing on any intraday chart with sufficient
historical data.
---8<---------------------------
{Daily Stochastic Osc SMA}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
K:=Input("Daily Stochastic Oscillator %K Periods",1,99,5);
N:=Input("%K Slowing Periods" ,1,99,3);
R:=Input("%D SMA Periods",1,99,3);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2,1,Hw)));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2,1,Lw)));
Cw:=ValueWhen(1,J,If(J=1,C,ValueWhen(2,1,C)));
Hw:=ValueWhen(1,Hw>0,Hw);
Lw:=ValueWhen(1,Lw>0,Lw);
Cw:=ValueWhen(1,Cw>0,Cw);
Z:=Cum((Cw-LowestSince(K,J,Lw))*(J>0));
Z:=Z-ValueWhen(N+1,J,Z);
I:=Cum((HighestSince(K,J,Hw)- LowestSince(K,J,Lw))*(J>0));
I:=I-ValueWhen(N+1,J,I);
I:=ValueWhen(1,Cum(I>0)>0,I);
X:=100*Z/I; X:=ValueWhen(1,Cum(J>0)>=K+N,X);
Y:=Cum((J>0)*X); Y:=(Y-ValueWhen(R+1,J,Y))/R;
Y:=ValueWhen(1,Cum(J>0)>=K+N+R,Y);
X; {%K}
Y; {%D}
---8<---------------------------
=====================
Daily Timing Signals
=====================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Timing Signals" plots the 'J' timing signal that is used in every
daily indicator in this series. This signal has a value of "1" for the
user-specified last bar of the day, and a value of "2" for the first bar
of a new day.
---8<---------------------------
{Daily Timing Signals}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
J;
---8<---------------------------
=============
Daily Volume
=============
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Volume" plots the daily volume on any intraday chart with sufficient
historical data.
---8<---------------------------
{Daily Volume}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=If(M,V,PREV+V);
ValueWhen(1,J,If(J=1,K,ValueWhen(2-G,1,K)));
---8<---------------------------
======================
Daily Wilders - Close
======================
A prerequisite for this indicator is Jose Silva's "Calendar Day
counter".
"Daily Wilders - Close" plots the Wilders Smoothing daily average
of the close on any intraday chart with sufficient historical data.
---8<---------------------------
{Daily Wilders - Close}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on intraday charts with
Jose Silva's "Calendar Day counter"}
N:=Input("Daily Wilders Smoothing Periods",1,99,10);
A:=Input("Hour of Last Daily Bar" ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of day}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
I:=Fml("Calendar Day counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
N:=1/N;
If(Cum(G+J>0)<=2-G,K, ValueWhen(1,J,PREV)*(1-N)+K*N);
---8<---------------------------
http://www.metastocktips.co.nz/