Positive and Negative Reversals in RSI

#1
Is anyone familiar with the Positive and Negative Reversals in RSI charts as taught by Constance Brown (according to Andrew Cardwell).

I'm searching for an afl which can determine the Reversals in the charts as they occur realtime. Now I have to calculate manually the price targets.

Rules are explained below:

Author and trader, Andrew Cardwell discovered two other types of divergences which he called positive and negative. These divergences are found in every phase of a stock's movement... whether it's trending or range bound.
The beauty of positive and negative divergences is their ability to forecast price movement.

First, locate positive and negative reversal patterns in the RSI and label the troughs and peeks like this...



Using the corresponding closing prices, plug them into the following formula to get the new up-side price target...

( X - W ) + Y = price target

A down-side price target can be calculated using the negative reversal pattern. Label the peeks and trough on the RSI. Then, using the closing price, calculate the price objective with this formula...

Y - ( W - X ) = price target

Hopefully anyone can help to code such an afl.

Thanks in advance!
 
#2
For those not familiar with this technique: just try to calculate manually the pricetargets in different time frames and be amazed by the accuracy of the given price targets.

They often form (short term) turning points, to form another reversal which stays valid until the line between the RSI points gets crossed.

It sure is worth while to study this technique. And hopefully someone with good coding abilities can automate this process.
 

KelvinHand

Well-Known Member
#3
For those not familiar with this technique: just try to calculate manually the pricetargets in different time frames and be amazed by the accuracy of the given price targets.

They often form (short term) turning points, to form another reversal which stays valid until the line between the RSI points gets crossed.

It sure is worth while to study this technique. And hopefully someone with good coding abilities can automate this process.
Hi,

Do you got any info on Andrew Cardwell RSI Edge CFGMO ?
 

Raju

Well-Known Member
#4
................
 
Last edited:
#5
Once I was corresponding with Andrew Cardwell about some specific RSI issues. My intention was to set up a little brainstorm session about specific RSI behavior.

He quickly tried to interest me to buy his RSI course (for a lousy $ 1.500,-). Thereafter I received several emails just to push his course. For me that was the end of the discussion.

To make money from the markets theres no such thing as a golden indicator or a 'golden set of rules'. Its all in discipline and awareness that you are trading in probabilities.

The Positive and Negative Reversals help me to set a range of price targets, which are likely to be met.
Of course these price targets need to be validated with other techniques, but once you start calculating these targets, you will be amazed be which accuracy some of these targets are met.

Now my intention is to try to automate this process, just to cut short the manual calculations.

I hope someone can help me in coding these rules as mentioned above.
 
#6
No one who can and is willing to help in coding this afl?

This TA script (including extra hidden reversals) is coding for realtime calculation and drawing of PR and NR as they occur.

Hopefully someone can translate this into afl. It will prove to be a very powerfull tool in setting targets in intraday an EOD trading.

---
var
N, Peak, Trough :Integer;
NH, NL :Integer;
NDoud, NToud :Integer;
NHD1, NHD2 :Integer;
StartBar :Integer; // Calculate last bars to reduce calculation time
RSISeries :TSeries; // RSI(14)
less :Boolean;
ShowHidden :Boolean;
V6040 :Boolean;
TP :array of integer;

const
OB = 70;
OS = 30;
RSIperiod = 14;

Function NextTrough(Serie:Tseries; NStart:Integer) :Integer;
Var
I :Integer;
begin // find possible next trough
// left and right value must be higher
Result := Barcount-1;
for I := Nstart+1 to Barcount-3 do
if (serie <= serie[I-1]) and (serie < Serie[I+1]) then
begin
Result := I;
I := Barcount-1;
end;
end;

Function NextPeak(Serie:Tseries; NStart:Integer) :Integer;
Var
I :Integer;
begin // find possible next peak
// left and right value must be lower
Result := Barcount-1;
for I := Nstart+1 to Barcount-3 do
if (serie >= serie[I-1]) and (serie > Serie[I+1]) then
begin
Result := I;
I := Barcount-1;
end;
end;

Procedure HiddenNR(start,stop:Integer);
var
N, I, J, K :Integer;
HDV :Real;
HDBar :Array[0..42] of integer;
HDCounter :Integer;
txt :string;
TL :TTrendline;

begin
// extra loop to find hidden reversals
N := start;
HDCounter := 0;
NHD1 := Start;
NHD2 := Stop;
While N < Stop do
begin
N := NextPeak(RSISeries,N);
if (N < Stop) and (HDCounter < 40) then
begin
HDBar[HDCounter] := N;
if HDCounter < 40 then HDCounter := HDCounter + 1;
end;
end;

if HDCounter > 4 then
begin
for N := 0 to HDCounter-3 do
begin
for I := N+2 to HDCounter-1 do
begin
if RSISeries[HDBar[N]] < RSISeries[HDBar] then
if Close[HDBar[N]] > Close[HDBar] then
if Highest(RSISeries, HDBar[N]+1,HDBar-1) < RSISeries[HDBar[N]] then
begin
J := LowestIndex(RSISeries,HDBar[N],HDBar);
if RSISeries[J] < RSISeries[HDBar[N]] then
begin
HDV := close[HDBar]-close[HDBar[N]]+close[J];
if (HDBar[N] > NHD1) and (HDBar < NHD2) then
begin
NHD1 := HDBar[N];
NHD2 := HDBar;
TL := CreateTrendline(Barposition[HDBar[N]], RSISeries[HDBar[N]],
Barposition[HDBar], RSISeries[HDBar])
if TrendlineValue(TL,Barposition[Barcount-1]) < 100 then
TL.color := ClYellow else TL.color := clGray;

if lowest(low,HDBar,barcount-2) > HDV then
txt := 'HNR '+ formatFloat('0.00',HDV)
else txt := '(' + formatFloat('0.00',HDV) + ')';

K := round((HDBar[N]+HDBar)/2);
with CreateText(BarPosition[K], RSISeries[HDBar[N]],txt) do
begin
VertPosition := vpTop;
color := TL.color;
end;

TP[HDBar] := -3;
TP[HDBar[N]] := -3;
N := I;
end;
end;
end;
end;
end;
end;
// einde extra loop
end;

Procedure HiddenPR(start,stop:Integer);
var
N, I, J, K :Integer;
HDV :Real;
HDBar :Array[0..42] of integer;
HDCounter :Integer;
txt :string;
TL :TTrendline;

begin
// extra loop to find hidden reversals
N := start;
HDCounter := 0;
NHD1 := Start;
NHD2 := Stop;
While N < Stop do
begin
N := NextTrough(RSISeries,N);
if (N < Stop) and (HDCounter < 40) then
begin
HDBar[HDCounter] := N;
if HDCounter < 40 then HDCounter := HDCounter + 1;
end;
end;
if HDCounter > 4 then
begin
for N := 0 to HDCounter-3 do
begin
for I := N+2 to HDCounter-1 do
begin
if RSISeries[HDBar[N]] > RSISeries[HDBar] then
if Close[HDBar[N]] < Close[HDBar] then
if lowest(RSISeries, HDBar[N]+1,HDBar-1) > RSISeries[HDBar[N]] then
begin
J := HighestIndex(RSISeries,HDBar[N],HDBar);
if RSISeries[J] > RSISeries[HDBar[N]] then
begin
HDV := close[HDBar]-close[HDBar[N]]+close[J];
if (HDBar[N] > NHD1) and (HDBar < NHD2) then
begin
NHD1 := HDBar[N];
NHD2 := HDBar;
TL := CreateTrendline(Barposition[HDBar[N]], RSISeries[HDBar[N]],
Barposition[HDBar], RSISeries[HDBar])
if TrendlineValue(TL,Barposition[Barcount-1]) > 0 then
TL.color := clAqua else TL.color := clGray;

if Highest(High,HDBar,Barcount-1) < HDV then
txt := 'HPR '+ formatFloat('0.00',HDV)
else txt := '(' + formatFloat('0.00',HDV) + ')';
K := round((HDBar[N]+HDBar)/2);
CreateText(BarPosition[K], RSISeries[HDBar[N]],txt).color := TL.color;

TP[HDBar[N]] := +3;
TP[HDBar] := +3;
N := I;
end;
end;
end;
end;
end;
end;
// einde extra loop
end;

Function TestNR(Top:Integer; var L:Integer) :Boolean;
Var
NT, Nx, N :Integer; // NT= position next high
Slope1, Slope2 :Real;
NR :Real;
VTL :Real; // Valua trendline at position x
txt :string;
TL :TTrendline;
begin
(* calculate and draw NR *)
Nx := Top+2;
if Nx > Barcount-1 then Nx := Barcount-1;
NT := Barcount-1;
Slope1 := 0;
while Nx <= Barcount-2 do
begin
Slope2 := (RSISeries[Top]-RSISeries[Nx])/(Nx-Top);
If Slope2 <= Slope1 then
begin
NT := Nx;
Slope1 := Slope2;
end;
Nx := Nx+1;
end;

if (Close[Top] > Close[NT]) and
(RSISeries[Top] < RSISeries[NT])then
begin
Result := True;
L := lowestIndex(RSISeries,Top,NT);
NR := Close[L] + close[NT] - close[Top];
if NR > 10 then
begin
if lowest(low,NT,barcount-1) > NR then
txt := 'NR '+ formatFloat('0.00',NR)
else txt := '(' + formatFloat('0.00',NR) + ')';
end else
begin
if lowest(low,NT,barcount-1) > NR then
txt := 'NR '+ formatFloat('0.000',NR)
else txt := '(' + formatFloat('0.000',NR) + ')';
end;
TL := CreateTrendline(Barposition[Top], RSISeries[Top], Barposition[NT], RSISeries[NT]);
TL.style := LsDot;

VTL := TrendlineValue(TL, BarPosition[Barcount-1]);
if VTL < 100 then TL.color := clYellow else TL.color := clGray;

if less and (NToud <> NT) then
begin
N := round((Top+NT)/2);
with CreateText(BarPosition[N], RSISeries[NT], txt) do
begin
VertPosition := vpTop;
color := TL.color;
end
end else
begin
with CreateText(BarPosition[Top], RSISeries[Top], txt) do
begin
VertPosition := vpTop;
color := TL.color;
end
end;
NToud := NT;
TP[NT] := -2;
TP[Top] := -2;

if ShowHidden then HiddenNR(Top,NT);
end;
end;

Function TestPR(Dal:Integer; var H:Integer) :Boolean;
Var
ND, Nx, N :Integer;
Slope1, Slope2 :Real;
PR :Real;
VTL :Real;
txt :string;
TL :TTrendline;

begin
(* calculate and draw *)
Nx := Dal+2;
if Nx > Barcount-1 then Nx := Barcount-1;
ND := Barcount-1;
Slope1 := 0;
while Nx <= Barcount-2 do
begin
Slope2 := (RSISeries[Dal]-RSISeries[Nx])/(Nx-Dal);
If Slope2 >= Slope1 then
begin
ND := Nx;
Slope1 := Slope2;
end;
Nx := Nx+1;
end;

if (close[Dal] < close[ND]) and
(RSISeries[Dal] > RSISeries[ND]) then
begin
Result := true;
H := HighestIndex(RSISeries,Dal,ND);
PR := Close[H] + close[ND] - close[Dal];
if PR > 10 then
begin
if Highest(High,ND,Barcount-1) < PR then
txt := 'PR '+ formatFloat('0.00',PR)
else txt := '(' + formatFloat('0.00',PR) + ')';
end else
begin
if Highest(High,ND,Barcount-1) < PR then
txt := 'PR '+ formatFloat('0.000',PR)
else txt := '(' + formatFloat('0.000',PR) + ')';
end;
TL := CreateTrendline(Barposition[Dal], RSISeries[Dal], Barposition[ND], RSISeries[ND]);
TL.style := LsDot;

VTL := TrendlineValue(TL, BarPosition[Barcount-1]);
if VTL > 0 then TL.color := claqua else TL.color := clGray;

if less and (NDoud <> ND) then
begin
N := round((Dal+ND)/2);
with CreateText(BarPosition[N], RSISeries[ND], txt) do
begin
color := TL.color;
if RSISeries[ND]>30 then VertPosition := vpBottom;
end;

end else
begin
with CreateText(BarPosition[Dal], RSISeries[Dal], txt) do
begin
if RSISeries[ND]>30 then VertPosition := vpBottom;
color := TL.color;
end;
end;
NDoud := ND;
TP[ND] := 2;
TP[Dal] := 2;

if ShowHidden then HiddenPR(Dal+2,ND-2);
end;
end;

Procedure TradeSignals;
var
N :Integer;
begin
for N :=startbar to barcount-2 do
begin
if TP[N] > 1 then enterlong(N+1);
if TP[N] < -1 then entershort(N+1);
end;
end;

Procedure TradeSignalsLevels;
var
N :Integer;
PInfo :TPositionInfo;
begin
for N :=startbar to barcount-2 do
begin
if RSISeries[N] > 60 then enterlong(N+1);
if RSISeries[N] < 40 then entershort(N+1);
CalcPositionInfo(N,PInfo);
If PInfo.long and (RSISeries[N] < 50) then exitlong(N+1);
if (not PInfo.long) and (RSISeries[N] > 50) then exitshort(N+1);
end;
end;



begin
with Indicator do
begin
ShortName := 'NRPR';
RequiredBars := 30;
SafeRefreshInterval := 10;
FutureBars := 3;
HiddenParams:= True;
end;

// ShowHidden := CreateParameterBoolean('Hidden reversals', True, false);
// less := CreateParameterBoolean('less lines', True, false);
V6040 := CreateParameterBoolean('Use 60 and 40 level', True, True);
ShowHidden := True;
less := True;

SetArrayLength(TP, BarCount);
for N := 0 to barcount-1 do TP[N] := 0;

if Toonhidden then
StartBar := Barcount - 1000 // confine calculation to last 1000 bars
else
StartBar := Barcount - 5000; // without hidden more bars

If StartBar < 20 then StartBar := 20;

if Barcount > 20 then
begin
RSISeries := RSI(Close, RSIperiod);

For N := StartBar to Barcount-5 do
begin
Peak := NextPeak(RSISeries,N);
if TestNR(Peak,NL) then
begin
N :=Peak;
if less then
if N < NL then N := NL;
end else
begin
N :=Peak;
end;
end;

For N := StartBar to Barcount-5 do
begin
Trough := NextTrough(RSISeries,N);
if TestPR(Trough, NH) then
begin
N := Trough;
if less then
if N < NH then N := NH;
end else
begin
N := Trough;
end;
end;

if V6040 then
TradesignalsLevels
else
Tradesignals;

with CreateTrendline(Barposition[1], OB, Barposition[BarCount-2], OB) do
begin
color := clRed;
ValueVisible := False;
ExtendRight:= True;
DrawBehindChart := True;
end;

with CreateTrendline(Barposition[1], OS, Barposition[BarCount-2], OS) do
begin
color := clRed;
ValueVisible := False;
ExtendRight:= True;
DrawBehindChart := True;
end;
end;

with CreateLine(RSISeries) do
begin
Name := 'RSI';
Color := RGB(0,200,0);
colortype := ctIndicator;
ValueVisible := True;
end;

end.
---
 
#7
OK, I tried. I could have used some help here, but I understand the hold back.

First you have to experience the power of an indicator before you spend time to understand it...it should be the other way around.

I will code the afl myself, although it will take me probably several weeks or maybe months..;)

Thread may be closed.

Bye
 
#8
OK, I tried. I could have used some help here, but I understand the hold back.

First you have to experience the power of an indicator before you spend time to understand it...it should be the other way around.

I will code the afl myself, although it will take me probably several weeks or maybe months..;)

Thread may be closed.

Bye
Some illustrations using concurrent charts will evoke much interest here. Not many members here use RSI.
 
#10
Techtrade your intention is great, but self could not help you as no knowledge of code. But this my request is you can kindly pass on to me. regards
 

Similar threads