Looking for areas of oversold and overbought

Highlights

Buy


P1:=Mov(((C-LLV(L,15))/(HHV(H,15)-LLV(L,15)))*100,3,E);
P2:=Mov(((C-LLV(L,30))/(HHV(H,30)-LLV(L,30)))*100,3,E);
P3:=Mov(((C-LLV(L,45))/(HHV(H,45)-LLV(L,45)))*100,3,E);
P4:=Mov(((C-LLV(L,90))/(HHV(H,90)-LLV(L,90)))*100,3,E);
A1:=Mov(((P1-LLV(P1,15))/(HHV(P1,15)-LLV(P1,15)))*100,3,E);
A2:=Mov(((P2-LLV(P2,30))/(HHV(P2,30)-LLV(P2,30)))*100,3,E);
A3:=Mov(((P3-LLV(P3,45))/(HHV(P3,45)-LLV(P3,45)))*100,3,E);
A4:=Mov(((P4-LLV(P4,90))/(HHV(P4,90)-LLV(P4,90)))*100,3,E);
Buy:=A1<5 AND A2<5 AND A3<5 AND A4<5;
Sell:=A1>95 AND A2>95 AND A3>95 AND A4>95;
Buy


Sell

P1:=Mov(((C-LLV(L,15))/(HHV(H,15)-LLV(L,15)))*100,3,E);
P2:=Mov(((C-LLV(L,30))/(HHV(H,30)-LLV(L,30)))*100,3,E);
P3:=Mov(((C-LLV(L,45))/(HHV(H,45)-LLV(L,45)))*100,3,E);
P4:=Mov(((C-LLV(L,90))/(HHV(H,90)-LLV(L,90)))*100,3,E);
A1:=Mov(((P1-LLV(P1,15))/(HHV(P1,15)-LLV(P1,15)))*100,3,E);
A2:=Mov(((P2-LLV(P2,30))/(HHV(P2,30)-LLV(P2,30)))*100,3,E);
A3:=Mov(((P3-LLV(P3,45))/(HHV(P3,45)-LLV(P3,45)))*100,3,E);
A4:=Mov(((P4-LLV(P4,90))/(HHV(P4,90)-LLV(P4,90)))*100,3,E);
Buy:=A1<5 AND A2<5 AND A3<5 AND A4<5;
Sell:=A1>95 AND A2>95 AND A3>95 AND A4>95;
Sell


 

I'd Like to obtain Tom DeMarks Sequential trading system in a MetaStock Expert format. Anyone know where I could start the search? Or can it be purchased from the Equis formula script writers? MS Support was kind enough to provide some basic formulas but I'm not able to make it into a running program

Hi Charlie,

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
 


 

Indicator of the above code

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;
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;
If(BUY,1,If(SELL,-1,0))


How can I make my volume green for up bars and red for down?  

To accomplish this, two custom indicators will be needed.
The following formulas will display the volume green when the close price is greater than the prior closing price and display the volume red when the close price is less than the prior closing price. To create the indicator;

Open the Tools menu
Select Indicator Builder
Click on New.
Name your indicator (for example Volume Up)
Enter the following syntax into the Formula field:

If(C>=ref(C,-1),V,0)

Click OK

Open the Tools menu
Select Indicator Builder
Click on New.
Name your indicator (for example Volume Down)
Enter the following syntax into the Formula field:

If(C<ref(C,-1),V,0)

Click on OK.

You should now have 2 new indicators in your QuickList.
Apply the Volume Up indicator to a new inner windows in your chart
Right click on the indicator and select properties.
Change the color to green and style histogram, and then click on OK
Apply the Volume Down indicator to same inner window as the Volume Up
Right click on the indicator and select properties.
Change the color to red and style histogram, and then click on OK

I would recommend saving this as a template, perhaps your default template, so that you do not have to do this every time you want it applied to a chart.

Patrick do you have the formula for the MACD histogram for Green above zero and red below. Thanks

MACDV:=MACD() - Mov(MACD(),9,E);
If(Roc(MACDV,1,%)>=0,MACDV,0);
If(Roc(MACDV,1,%)<0,MACDV,0);


Hello,
I search an exploration which will find a divergence between the Close and an indicator (RSI(14) for example).

You should modify this formula :

For Peaks :

z:=3; { Percent retracement to use }
plot1:= RSI(14);
STOCK:=(Peak(1,H,z)>Peak(2,H,z));
I1:=Peak(1,plot1,z)<Peak(2,plot1,z);
STOCK AND I1

For Troughs :

z:=3;{ Percent retracement to use }
plot1:= RSI(14);
STOCK:=(Trough(1,L,z)<Trough(2,L,z));
I1:=Trough(1,plot1,z)>Trough(2,plot1,z);
STOCK AND I1


I created one Know For Sure Indicator (i.e. KST by Martin Pring) and I wanted to use it on a Relative Strength Comparative Chart

You need to use :

Mov(ROC(P,10,$),10,S)*1+Mov(ROC(P,15,$),10,S)*2+Mov(ROC(P,20,$),10,S)*3+Mov(ROC(P,30,$),15,S)*4

Make sure to still apply this to the RSC indicator.


I don't know if this is correct, but I figured I would post this :

CD:=Inside();
CD1:=If(CD,0,
If(CD=0 AND
(H>Max(ValueWhen(2,CD=0,H),ValueWhen(3,CD=0,H))
OR
L<Min(ValueWhen(2,CD=0,L),ValueWhen(3,CD=0,L))),1,0));
CD2:=If(CD1=0,0,
If(CD1 AND
(H>Max(ValueWhen(2,CD1,H),ValueWhen(3,CD1,H))
OR
L<Min(ValueWhen(2,CD1,L),ValueWhen(3,CD1,L))),1,0));
CD2


Is there an explorer code to scan for stocks that are a certain percent over a moving average? Thanks.

What about something like :

X:=2; {here represents 2 %}
MA:=Mov(C,10,S); {Moving average that can be substitued}
((C/MA)-1)*100>X {Close is 2 % greater or more than the average}


does anyone have two-day swing chart formula? much appreciated!

This is the formula for a Gann Swing :

{Market swing is defined as:
Up = 2 higher highs,
Down = 2 lower highs.}
Us:=BarsSince((H > Ref(H,-1)) AND (Ref(H,-1) >
Ref(H,-2)));
Ds:=BarsSince((L < Ref(L,-1)) AND (Ref(L,-1) <
Ref(L,-2)));
Sd1:=If(Us=0,
{then}If(Ref(L,-1)<>LowestSince(1,Ds=0,L),
{then}1,
{else}0),
{else}If(Ds=0,
{then}If(Ref(H,-1)<>
HighestSince(1,Us=0,H),
{then}-1,
{else}0),
{else}0));
Sd2:=If(Sd1=1,
{then} If(Ref(BarsSince(Sd1=1),-1) >
Ref(BarsSince(Sd1=-1),-1),
{then}1,
{else}0),
{else} If(Sd1=-1,
{then}If(Ref(BarsSince(Sd1=1),-1) <
Ref(BarsSince(Sd1=-1),-1),
{then}-1,
{else}0),
{else}0));
TD1:=ValueWhen(1,Sd2<>0,Sd2);
Td1;

This is only an indicator that will go from 1 to -1.
Ultimately I would create an expert using this indicator and the cross function, which will make a lot more sense than an indicator.
If that is not what you wanted then let me know more info, I might be able to create it for you.

If you want to draw level lines at the swing points, try using this :

Us:=BarsSince((H>Ref(H,-1)) AND (Ref(H,-1)>Ref(H,-2)));
Ds:=BarsSince((L<Ref(L,-1)) AND (Ref(L,-1)<Ref(L,-2)));
Sd1:=If(Us=0,If(Ref(L,-1)<>LowestSince(1,Ds=0,L),1,0),
If(Ds=0,If(Ref(H,-1)<>HighestSince(1,Us=0,H),-1,0),0));
Sd2:=If(Sd1=1,If(Ref(BarsSince(Sd1=1),-1)>
Ref(BarsSince(Sd1=-1),-1),1,0),If(Sd1=-1,
If(Ref(BarsSince(Sd1=1),-1)<Ref(BarsSince(Sd1=-1),-1), -1,0),0));
TD1:=ValueWhen(1,Sd2<>0,Sd2);
Up:=Cross(TD1,.5);
Dn:=Cross(-.5,TD1);
If(BarsSince(up)>BarsSince(Dn),ValueWhen(1,DN,Ref(H,-1)),ValueWhen(1,UP,Ref(L,-1)))

If you want to mark the bar when the swing occur ...
You would have to create a new expert advisor and use the highlights or symbols. In the symbols (or highlight tab) Click on New and call it Up swing ( or whatever ). Select the symbol, the color and its position. In the formula Type :

Us:=BarsSince((H>Ref(H,-1)) AND (Ref(H,-1)>Ref(H,-2)));
Ds:=BarsSince((L<Ref(L,-1)) AND (Ref(L,-1)<Ref(L,-2)));
Sd1:=If(Us=0,If(Ref(L,-1)<>LowestSince(1,Ds=0,L),1,0),
If(Ds=0,If(Ref(H,-1)<>HighestSince(1,Us=0,H),-1,0),0));
Sd2:=If(Sd1=1,If(Ref(BarsSince(Sd1=1),-1)>Ref(BarsSince(Sd1=-1),-1),1,0),
If(Sd1=-1,If(Ref(BarsSince(Sd1=1),-1)<Ref(BarsSince(Sd1=-1),-1),
-1,0),0));
TD1:=ValueWhen(1,Sd2<>0,Sd2);
Cross(TD1,.5)

Then Click on new again, this time call it Down swing,
Select the symbol, the color and its position.

Us:=BarsSince((H>Ref(H,-1)) AND (Ref(H,-1)>Ref(H,-2)));
Ds:=BarsSince((L<Ref(L,-1)) AND (Ref(L,-1)<Ref(L,-2)));
Sd1:=If(Us=0,If(Ref(L,-1)<>LowestSince(1,Ds=0,L),1,0),If(Ds=0,If(Ref(H,-1)<>
HighestSince(1,Us=0,H),-1,0),0));
Sd2:=If(Sd1=1,If(Ref(BarsSince(Sd1=1),-1)>Ref(BarsSince(Sd1=-1),-1),1,0),If(Sd1=-1,
If(Ref(BarsSince(Sd1=1),-1)<Ref(BarsSince(Sd1=-1),-1),
-1,0),0));
TD1:=ValueWhen(1,Sd2<>0,Sd2);
Cross(-.5,TD1)

Then attach the expert on your chart.
The way I did mine, it plotted a red arrow above the price bar on a down swing day and a green arrow below the price bar on a upswing day. But you could use anything symbol you want or highlights instead.