Breakout 42 Expert
Highlights
Long
B:=Ref(1.02*LLV(L,42),-1);
A1:=Ref(0.98*HHV(H,42),-1);
mi:=(A1+B)/2;
LE:=C>=Mi;
SE:=C<mi;
LE>SE
Short
B:=Ref(1.02*LLV(L,42),-1);
A1:=Ref(0.98*HHV(H,42),-1);
mi:=(A1+B)/2;
LE:=C>=Mi;
SE:=C<mi;
LE<SE
Symbols
Long entry
B:=Ref(1.02*LLV(L,42),-1);
A1:=Ref(0.98*HHV(H,42),-1);
mi:=(A1+B)/2;
LE:=C>=Mi;
SE:=C<mi;
LE>SE AND Ref(LE,-1)<Ref(SE,-1)
Short entry
B:=Ref(1.02*LLV(L,42),-1);
A1:=Ref(0.98*HHV(H,42),-1);
mi:=(A1+B)/2;
LE:=C>=Mi;
SE:=C<mi;
LE<SE AND Ref(LE,-1)>Ref(SE,-1)
plot this in the price
chart
B:=Ref(1.02*LLV(L,42),-1);
A1:=Ref(0.98*HHV(H,42),-1);
mi:=(A1+B)/2;
A1;mi;B;
Could anyone pls, provide me with an explorer code
that will explore for double bottoms/tops of price or indicator.
thank you in advance,
Nicholas
{Double Bottom}
plot:=CLOSE;
PK:=Zig(plot,10,%)<Ref(Zig(plot,10,%),-1) AND
Ref(Zig(plot,10,%),-1)>Ref(Zig(plot,10,%),-2);
TR:=Zig(plot,10,%)>Ref(Zig(plot,10,%),-1) AND
Ref(Zig(plot,10,%),-1)<Ref(Zig(plot,10,%),-2);
TR1:=TroughBars(1,plot,10);
TR2:=TroughBars(2,plot,10);
(ValueWhen(1,TR,Ref(plot,-1))/ValueWhen(2,TR,Ref(plot,-1))> 1 AND
ValueWhen(1,TR,Ref(plot,-1)) /
ValueWhen(2,TR,Ref(plot,-1))<1.06) AND TR2-TR1>=10 AND
Cross(plot,ValueWhen(1,PK,Ref(plot,-1)))
{Double Top}
plot:=Close;
PK:=Zig(plot,10,%)<Ref(Zig(plot,10,%),-1) AND
Ref(Zig(plot,10,%),-1)>Ref(Zig(plot,10,%),-2);
TR:=Zig(plot,10,%)>Ref(Zig(plot,10,%),-1) AND
Ref(Zig(plot,10,%),-1)<Ref(Zig(plot,10,%),-2);
PK1:=PeakBars(1,plot,10);
PK2:=PeakBars(2,plot,10);
(ValueWhen(1,PK,Ref(plot,-1))/ValueWhen(2,PK,Ref(plot,-1))>0.94 AND
ValueWhen(1,PK,Ref(plot,-1)) / ValueWhen(2,PK,Ref(plot,-1))<1) AND
PK2-PK1>=10 AND Cross(ValueWhen(1,TR,Ref(plot,-1)),plot)
I seek a formula by which I can plot Keltner Channels as popularised by Linda Rascke. She puts Keltner channels set at 2.5 times the 20-day EMA daily range, centered around the 20-period EMA. Any suggestions would be appreciated
I believe Linda Raschke version of the Keltner
channels formula was :
MOV(C,20,E);
MOV(C,20,E)+(ATR(10)*2.5);
MOV(C,20,E)-(ATR(10)*2.5);
Hello
The following is from the Stocks and Commodities Mag.
I have typed it in the best I can see but there appears to be problems. The idea
is that it it produces a normalized indicator.
Dear Martin,
I'm assuming you are talking about the TASC issue of January 2005 page 24.
I believe the right code for MetaStock is :
LinRegSlope(C,35)/ref(C,-35)*100>-.35 and LinRegSlope(C,35)/ref(C,-35)*100<.4
LinRegSlope(C,70)/ref(C,-70)*100>-.4 and LinRegSlope(C,70)/ref(C,-70)*100<.4
Though this does not seem to be a system or an indicator but part of the main
system which is coded on page 27.
I could post the system here if someone is interrested.
The name of the system is :
Penny Stock BreakOut System
{Buy Formula}
MACDH:=MACD()-MOV(MACD(),9,E);
SDC:=STDEV(C,30)/MOV(C,30,S);
PERIOD:=14;
COEF:=.1;
INTRA:=LOG(H)-LOG(L);
VINTRA:=STDEV(INTRA,PERIOD);
INTER:=LOG(TYPICAL())-LOG(REF(TYPICAL(),-1));
VINTER:=STDEV(INTER,PERIOD);
CUTOFF:=COEF*(VINTER+VINTRA)*C;
MF:=C-(H+L)/2+TYPICAL()-REF(TYPICAL(),-1);
FVE:=SUM(IF(MF>CUTOFF,+V,IF(MF<CUTOFF,-V,0)),PERIOD)/MOV(V,PERIOD,S)/PERIOD*100;
FVE>-1 AND LINREGSLOPE(C,35)/REF(C,-35)*100>-.35
AND LINREGSLOPE(C,35)/REF(C,-35)*100<.4
AND LINREGSLOPE(C,70)/REF(C,-70)*100>-.4
AND LINREGSLOPE(C,70)/REF(C,-70)*100<.4
AND LINREGSLOPE(C,170)/REF(C,-170)*100>-.2
AND MACDH>-.003
AND (SUM(SDC-LLV(SDC,150),3)/SUM(HHV(SDC,150)-LLV(SDC,150),3))*100<20
AND C>MOV(C,10,E) AND SDC*ADX(25)<1.3 AND STOCH(10,3)>30
{Exit Formula}
C<(1-18/100)*Ref(C,-1)
I'm using moving averages to screen potential stocks.
Actually my condition is to pick those stocks which just
cross the 20D MA. but the formula I used (if C > mov(C,20,S)) is getting out
stocks that its MA already above 20D MA. What I really want is the MA just
started to cross over so that it wont be stocks that has been overbought. I'm
not sure (if cross(C,mov(c,20,S))) is setting what I want?
Is MA a good tool to screen out potential stocks? any good advises
on stocks screening?
I can help you with the formula :
Cross(C,Mov(C,200,S))
Unfortunately I do not have an opinion has to wether or not it is a good way to
screen stocks.
My advice would be for you to set a goal for you trading.
For example you want to make $XXXX a Day/Week/month/Year and then consider which
stocks can you afford that have the potential of making you that money in that
time period ...
Then create or find a system based on these stocks and keep working with the
same stocks. Again I'm not a professional trader so what I say should never be
taken as gospel
I believe the Formula for the second system is :
{Enter Long}
HiVal:=Mo(H,10);
LoVal:=Mo(L,10);
RnVal:=Mo(H-L,6);
BC:=Cross(Min(HiVal,LoVal),RnVal);
SC:=Cross(RnVal,Max(HiVal,LoVal));
BC AND BarsSince(Ref(BC,-1))>BarsSince(Ref(SC,-1))
{Enter Short}
HiVal:=Mo(H,10);
LoVal:=Mo(L,10);
RnVal:=Mo(H-L,6);
BC:=Cross(Min(HiVal,LoVal),RnVal);
SC:=Cross(RnVal,Max(HiVal,LoVal));
SC AND BarsSince(Ref(BC,-1))<BarsSince(Ref(SC,-1))
They also use a trailing stop at 10%
{Enter Long}
BullTrend:=Cross(Mov(C,5,S),Max(Mov(C,10,S),Mov(C,20,S)));
BearTrend:=Cross(Min(Mov(C,10,S),Mov(C,20,S)),Mov(C,5,S));
Trend:=If(BarsSince(Ref(BullTrend,-1))<BarsSince(Ref(BearTrend,-1)),1,-1);
EnterLong:=Trend=1 AND Cross(Stoch(14,3),25);
ExitLong:=Trend=1 AND Cross(75,Stoch(14,3));
EnterShort:=Trend=-1 AND Cross(75,Stoch(14,3));
ExitShort:=Trend=-1 AND Cross(Stoch(14,3),25);
Status:=If(EnterLong,2,If(EnterShort,-2,If(ExitLong,1,If(ExitShort,-1,PREV))));
EL:=Cross(Status,1.5);
XL:=Cross(1.5,Status) AND Ref(Status,-1)=2;
ES:=Cross(-1.5,Status);
XS:=Cross(Status,-1.5) AND Ref(Status,-1)=-2;
EL
{Exit Long}
BullTrend:=Cross(Mov(C,5,S),Max(Mov(C,10,S),Mov(C,20,S)));
BearTrend:=Cross(Min(Mov(C,10,S),Mov(C,20,S)),Mov(C,5,S));
Trend:=If(BarsSince(Ref(BullTrend,-1))<BarsSince(Ref(BearTrend,-1)),1,-1);
EnterLong:=Trend=1 AND Cross(Stoch(14,3),25);
ExitLong:=Trend=1 AND Cross(75,Stoch(14,3));
EnterShort:=Trend=-1 AND Cross(75,Stoch(14,3));
ExitShort:=Trend=-1 AND Cross(Stoch(14,3),25);
Status:=If(EnterLong,2,If(EnterShort,-2,If(ExitLong,1,If(ExitShort,-1,PREV))));
EL:=Cross(Status,1.5);
XL:=Cross(1.5,Status) AND Ref(Status,-1)=2;
ES:=Cross(-1.5,Status);
XS:=Cross(Status,-1.5) AND Ref(Status,-1)=-2;
XL
{Enter Short}
BullTrend:=Cross(Mov(C,5,S),Max(Mov(C,10,S),Mov(C,20,S)));
BearTrend:=Cross(Min(Mov(C,10,S),Mov(C,20,S)),Mov(C,5,S));
Trend:=If(BarsSince(Ref(BullTrend,-1))<BarsSince(Ref(BearTrend,-1)),1,-1);
EnterLong:=Trend=1 AND Cross(Stoch(14,3),25);
ExitLong:=Trend=1 AND Cross(75,Stoch(14,3));
EnterShort:=Trend=-1 AND Cross(75,Stoch(14,3));
ExitShort:=Trend=-1 AND Cross(Stoch(14,3),25);
Status:=If(EnterLong,2,If(EnterShort,-2,If(ExitLong,1,If(ExitShort,-1,PREV))));
EL:=Cross(Status,1.5);
XL:=Cross(1.5,Status) AND Ref(Status,-1)=2;
ES:=Cross(-1.5,Status);
XS:=Cross(Status,-1.5) AND Ref(Status,-1)=-2;
ES
{Exit Short}
BullTrend:=Cross(Mov(C,5,S),Max(Mov(C,10,S),Mov(C,20,S)));
BearTrend:=Cross(Min(Mov(C,10,S),Mov(C,20,S)),Mov(C,5,S));
Trend:=If(BarsSince(Ref(BullTrend,-1))<BarsSince(Ref(BearTrend,-1)),1,-1);
EnterLong:=Trend=1 AND Cross(Stoch(14,3),25);
ExitLong:=Trend=1 AND Cross(75,Stoch(14,3));
EnterShort:=Trend=-1 AND Cross(75,Stoch(14,3));
ExitShort:=Trend=-1 AND Cross(Stoch(14,3),25);
Status:=If(EnterLong,2,If(EnterShort,-2,If(ExitLong,1,If(ExitShort,-1,PREV))));
EL:=Cross(Status,1.5);
XL:=Cross(1.5,Status) AND Ref(Status,-1)=2;
ES:=Cross(-1.5,Status);
XS:=Cross(Status,-1.5) AND Ref(Status,-1)=-2;
XS
{EnterLong}
BullTrend:=Cross(Mov(C,5,S),Max(Mov(C,10,S),Mov(C,20,S)));
BearTrend:=Cross(Min(Mov(C,10,S),Mov(C,20,S)),Mov(C,5,S));
Trend:=If(Barssince(Ref(BullTrend,-1))<Barssince(Ref(BearTrend,-1)),1,-1);
EnterLong:=Trend=1 and {your oscillator condition here};
ExitLong:=Trend=1 and {your oscillator condition here};
EnterShort:=Trend=-1 and {your oscillator condition here};
ExitShort:=Trend=-1 and {your oscillator condition here};
EnterLong and Barssince(ref(EnterLong,-1))>Min(Barssince(Ref(ExitLong,-1)),Min(Barssince(Ref(EnterShort,-1)),Barssince(Ref(ExitShort,-1))))
This is an example and might not be completely accurate but it should help you
create your system/expert.
I'm using 14,3,3 but you can replace these values.
{Cross %k Above %D}
K:=14;
Kslowing:=3;
D:=3;
StoK:=Stoch(K,Kslowing);
stoD:=Mov(Stoch(K,Kslowing),D,S);
Cross(StoK,StoD)
{Cross %D Above %K}
K:=14;
Kslowing:=3;
D:=3;
StoK:=Stoch(K,Kslowing);
stoD:=Mov(Stoch(K,Kslowing),D,S);
Cross(StoD,StoK)
Hello!
I try to input an interesting formula to Metastock 7.21. I found out there are
some tricks required. Have a look at the code and comment if it is equivalent to
the EasyStation code below:
{John Ehlers instant trendline}
Pr:=(HIGH+LOW)/2;
alpha:=0.07;
Itrend:=0;
Trigger:=0;
Itrend := If(Cum(1)<7,(pr+2*Ref(pr,-1)+Ref(pr,-2))/4,((alpha-alpha*alpha/4)*Pr+0.5*alpha*alpha*Ref(Pr,-1)-(alpha-0.75*alpha*alpha)*Ref(Pr,-2)+2*(1-alpha)*PREV-(1-alpha)*(1-alpha)*Ref(PREV,-1)));
Trigger := 2*Itrend - Ref(ITrend,-2);
{plotting}
Itrend;
Trigger;
{code ends here}
The most important is the long Itrend line . There is different formula for
first 7 bars, and different for subsequent bars. When I used ref(itrend,-1)
instead of prev and ref(itrend,-2) instead of (prev,-1), the indicator plotted
wrong.
The original code in EasyStation from Ehlers' book there is as follows:
Inputs: Price((H+L)/2),
alpha(.07);
Vars: Smooth(0),
ITrend(0),
Trigger(0);
ITrend = (alpha - alpha*alpha/4)*Price + .5*alpha*alpha*Price[1] - (alpha-
.75*alpha*alpha)*Price[2] + 2*(1 - alpha)*ITrend[1] - (1-alpha)*(1 -
alpha)*Itrend[2];
If currentbar < 7 then ITrend = (Price + 2*Price[1] + Price[2]) / 4;
Trigger = 2*Itrend - ITrend[2];
Plot1(Itrend, ITrend);
Plot2(Trigger, Trig);
Please comment, how would you convert this code. I am not sure if I got it right
{Buy}
(MACD()>Mov(MACD(),9,e)) and (ref(MACD(),-1)<ref(Mov(MACD(),9,e),-1)) and
MO(C,20)>100
{SELL}
(MACD()<Mov(MACD(),9,e)) and (ref(MACD(),-1)>ref(Mov(MACD(),9,e),-1)) and
MO(C,20)<100
Apologies guys fell down a black hole! Thanks for all
your help. This is where I think I have got too. I would very much appreciate
your feedback:
Modified Moving Average 8 Day Period MMA8
N:=8;
TN8:=Mov(C,N,S);
s8:=((n-1)/2)*
C+((n-3)/2)*
Ref(C,-1)+((n-5)/2)*
Ref(C,-2)+((n-7)/2)*
Ref(C,-3)+((n-9)/2)*
Ref(C,-4)+((n-11)/2)*
Ref(C,-5)+((n-13)/2)*
Ref(C,-6)+((n-15)/2)*
Ref(C,-7),
MMA8:=TN8+(6*S8)/((n+1)*n);
MMA8
Modified Moving Average 9 Day Period MMA9
N:=9;
TN9:=Mov(C,N,S);
s9:=((n-1)/2)*
C+((n-3)/2)*
Ref(C,-1)+((n-5)/2)*
Ref(C,-2)+((n-7)/2)*
Ref(C,-3)+((n-9)/2)*
Ref(C,-4)+((n-11)/2)*
Ref(C,-5)+((n-13)/2)*
Ref(C,-6)+((n-15)/2)*
Ref(C,-7)+((n-17)/2)*
Ref(C,-8),
MMA9:=TN9+(6*S9)/((n+1)*n);
MMA9
Modified Moving Average 17 Day Period MMA17
N:=17;
TN17:=Mov(C,N,S);
s17:=((n-1)/2)*
C+((n-3)/2)*
Ref(C,-1)+((n-5)/2)*
Ref(C,-2)+((n-7)/2)*
Ref(C,-3)+((n-9)/2)*
Ref(C,-4)+((n-11)/2)*
Ref(C,-5)+((n-13)/2)*
Ref(C,-6)+((n-15)/2)*
Ref(C,-7)+((n-17)/2)*
Ref(C,-8)+((n-19)/2)*
Ref(C,-9)+((n-21)/2)*
Ref(C,-10)+((n-23)/2)*
Ref(C,-11)+((n-25)/2)*
Ref(C,-12)+((n-27)/2)*
Ref(C,-13)+((n-29)/2)*
Ref(C,-14)+((n-31)/2)*
Ref(C,-15)+((n-33)/2)*
Ref(C,-16),
MMA17:=TN17+(6*S17)/((n+1)*n);
MMA17
Substituting the above into this standard MACD formula:
Standard MACD
shortperiods:=Input("Enter the shorter MOV periods: ",8);
longperiods:=Input("Enter the longer MOV periods: ",17);
signal:=Input("Enter the number of signal line periods: ",9);
MOV(C,shortperiods)-MOV(C,longperiods);
MOV(MOV(C,shortperiods,E)-MOV(C,longperiods,E),signal,E)
Should give the following:
N:=8;
TN8:=Mov(C,N,E);
s8:=((n-1)/2)*
C+((n-3)/2)*
Ref(C,-1)+((n-5)/2)*
Ref(C,-2)+((n-7)/2)*
Ref(C,-3)+((n-9)/2)*
Ref(C,-4)+((n-11)/2)*
Ref(C,-5)+((n-13)/2)*
Ref(C,-6)+((n-15)/2)*
Ref(C,-7),
MMA8:=TN8+(6*S8)/((n+1)*n);
N:=17;
TN17:=Mov(C,N,E);
s17:=((n-1)/2)*
C+((n-3)/2)*
Ref(C,-1)+((n-5)/2)*
Ref(C,-2)+((n-7)/2)*
Ref(C,-3)+((n-9)/2)*
Ref(C,-4)+((n-11)/2)*
Ref(C,-5)+((n-13)/2)*
Ref(C,-6)+((n-15)/2)*
Ref(C,-7)+((n-17)/2)*
Ref(C,-8)+((n-19)/2)*
Ref(C,-9)+((n-21)/2)*
Ref(C,-10)+((n-23)/2)*
Ref(C,-11)+((n-25)/2)*
Ref(C,-12)+((n-27)/2)*
Ref(C,-13)+((n-29)/2)*
Ref(C,-14)+((n-31)/2)*
Ref(C,-15)+((n-33)/2)*
Ref(C,-16),
MMA17:=TN17+(6*S17)/((n+1)*n);
MMA8-MMA17
N:=9;
TN9:=Mov((MMA8-MMA17),N,E);
s9:=((n-1)/2)*
(MMA8-MMA17)+((n-3)/2)*
Ref((MMA8-MMA17),-1)+((n-5)/2)*
Ref((MMA8-MMA17),-2)+((n-7)/2)*
Ref((MMA8-MMA17),-3)+((n-9)/2)*
Ref((MMA8-MMA17),-4)+((n-11)/2)*
Ref((MMA8-MMA17),-5)+((n-13)/2)*
Ref((MMA8-MMA17),-6)+((n-15)/2)*
Ref((MMA8-MMA17),-7)+((n-17)/2)*
Ref((MMA8-MMA17),-8),
MMA9:=TN9+(6*S9)/((n+1)*n);
I have the following questions regarding the above:
1. I have made all the formulae exponential even though some people use simple
moving averages Is this correct for a strict interpretation of DiNapoli.
2. Does everyone agree with the logic?
3. Is this syntactically correct (me never having coded an indicator before
probably shows too!)? Ideally I would like to cut and paste it directly into
Metastock. For instance should I be using different N and n in each section?
4. Lastly, pumrysh I do not understand the purpose / necessity for this section
of your coding:
{Zero Lag EMA}
Period:= Input("What Period",1,250,10);
EMA1:= Mov(P,Period,E);
EMA2:= Mov(EMA1,Period,E);
Difference:= EMA1 - EMA2;
ZeroLagEMA:= EMA1 + Difference;
ZeroLagEMA {end}
--
Carriolan
I don't know if Equis support gave you these formulas
but here is how you should write your system or expert
For the Buy signal I would use :
Bsetup:=Sum(C<Ref(C,-4),9)=9;
BCD:=HighestSince(1,Peak(1,Bsetup,.001),(C<Ref(L,-2)) + PREV);
BUY:=BCD-ValueWhen(1,Bsetup,BCD)=13 AND
Ref(BCD-ValueWhen(1,Bsetup,BCD)=13,-1)<>1;
BUY
For the sell signal I would use :
Ssetup:=Sum(C>Ref(C,-4),9)=9;
SCD:=HighestSince(1,Peak(1,Ssetup,.001),(C>Ref(H,-2)) + PREV);
SELL:=SCD-ValueWhen(1,Ssetup,SCD)=13 AND
Ref(SCD-ValueWhen(1,Ssetup,SCD)=13,-1)<>1;
SELL
If any of you have a better way of doing it, please do not hesitate to post your
version of Demark's sequential. As I have actually seen different version of
this ...
Hope this helps
First, you have to figure out to find the 'low'. You
might want to look in your manual for things like the peak() and trough()
functions (but read the warnings about these too). Otherwise you might like to
do it more programatically, like:
tr:=l>ref(l,-1) and ref(l,-1)<ref(l,-2) and ref(l,-2)<ref(l,-3);
This will return '1' each time there is a 'trough'. Now to see if the low is
higher or lower than the previos time, use the valuewhen() function:
valuewhen(1,tr=1,l)<valuewhen(2,tr=1,l)
will return '1' each time the low (when tr=1) is less than the low (the time
previously, when tr=1)
All this information is readily available in your user manual and through the
Equis Formula Primer, both of which I strongly recommend all MS users to read.
Hope this helps