# Group Mentoring: October 14, 2020

Strategy Testing Code:

```vars:
r(0),
rp(0),
cp(0);
r = rsi(c,14);
rp = (r - lowest(r,50)) / (highest(r,50) - lowest(r,50));
cp = (c - lowest(c,50)) / (highest(c,50) - lowest(c,50));
{PF 3.7, 87k, 10 years, 100k size, better than baseline rsi50}
if c > average(c,200) and cp >= rp then buy 1000/AvgTrueRange(200) shares this bar close else sell this bar close;
{dud}
//if cp > .5 and rp < .5 then buy 10000/c shares this bar close else sell this bar close;
{no
if cp > .5 and rp < .5 then buy 10000/c shares this bar close;
if cp < .5 then sell this bar close; }
//if cp > .5 and rp > .5 then buy 10000/c shares this bar close else sell this bar close;
{no on daily}
//if cp >= rp and r > 50 then buy 10000/c shares this bar close else sell this bar close;
//if r > 50 then buy 10000/c shares this bar close else sell this bar close;```

Indicator Code:

```vars:
r(0),
rp(0),
cp(0);
r = rsi(c,14);
rp = (r - lowest(r,50)) / (highest(r,50) - lowest(r,50));
cp = (c - lowest(c,50)) / (highest(c,50) - lowest(c,50));
plot1(rp,"rp",red);
plot2(cp,"cp",cyan);
plot3(.5);```

RSI Price Percentile Divergence and Comparison