Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
> Exponential Moving Average (13 periods) = EMA 13
> Exponential Moving Average (34 periods) = EMA 34
> DMI Spread = DMI+[14] – -DMI-[14]
> MACD 3-8-13 (see below the Metastock code)
DiffOfAvg:= Mov(CLOSE, 3, E) - Mov(CLOSE, 8, E);
DiffOfAvg;
Mov(DiffOfAvg,13,E);
Mov(CLOSE, 3, E) - Mov(CLOSE, 8, E);
DiffOfAvg - Mov(DiffOfAvg,13,E)
SETUP 1
> EMA13 > EMA34
> Price today is the highest price in the last 21 days (point 1 on the graph)
> In this day DMI Spread is > 15 (point 2 on the graph)
[color=red:eb41796e68]Mov(C,13,E)>Mov(C,34,E) AND
C>=HHV(C,21) AND
(Pdi(14)-mdi(14))>15[/color]
SETUP 2 (retracement)
> There is a retracement between 38.2% and 61.8% Fibonacci zones (point 3 on the graph)
> Fibonacci retracement must be plot from the initial trend to the highest price in the last 21 days (point 4 on the graph).
[color=blue:eb41796e68]Personally, I do NOT like this code, nor do I recommend that you use it. Due to the dynamic nature of the Zig(), Peak() and Trough() functions, these indicators will move with time - - they are based on hindsight and hence cannot be traded in real life/time. My recommendation is to use the other filter criteria to find a small subset of stocks, then manually apply the fib indicator. Its more work, yes, but ts safer and that will save you money in the long run![/color]
[color=red:eb41796e68]Pk:=Peak(1,C,5);
Tr:=Trough(1,C,5);
i:=Cum(Pk+Tr>-1)=1;
{Check the peak is more recent than the trough}
rightOrder:=ROC(Zig(C,5,%),1,%)<0;
newPk:=C>=Pk AND C>=HHV(C,21);
newPkVal:=ValueWhen(1,newPk,C);
PkTrRange:=newPkVal-Tr;
PkCRange:= newPkVal-C;
pct:=100*PkCRange / PkTrRange;
pct:=rightorder*pct;
pct>38.2 AND pct<61.8;[/color]
> MACD 3-8-13 cross down the signal line (point 5 on the graph) for the first time since when the signal line is positive
[color=red:eb41796e68]myMACD:=Mov(C,3,E)-Mov(C,8,E);
signalLine:=Mov(myMACD,13,E);
{MACD Signal Counter : - with thanks to Roy Larsen}
a:=myMACD<signalLine;
b:=signalLine<0;
i:=Cum(a+b>-1)=1;
g:=Cum(a)-ValueWhen(1,i OR b,Cum(a));
{filter}
g=1;[/color]
ENTRY
> MACD signal line remain positive
> MACD Histogram > MACD Histogram previous day (point 6 on the graph).
[color=red:eb41796e68]myMACD:=Mov(C,3,E)-Mov(C,8,E);
signalLine:=Mov(myMACD,13,E);
myMACDHist:= myMACD- signalLine;
{filter}
signalLine>0 AND
myMACDHist>Ref(myMACDHist,-1)
[/color]
I hope I have these interpretations correct. If not, let me know and we can work on them together.
wabbit :D
|