# Scanning RSI and MACD 3 years high

Hi,

I want to write an end of month scan for a below criteria

Monthly RSI move to three years (36 monthly bar) high or
A new RSI move past 70 or
All time RSI high Or new price breakout while the monthly RSI already above 70
AND
MACD( parameter 12,26,9 OR 4,9,3) make three years high.

I am trying these scrip

M1 = RSI(TYPE=RSI,BARS=14);

H1 = HIGHESTHIGH(M1,BARS=36);

L1 = LOWESTLOW(M1,BARS=36);

M1 CROSSESABOVE H1 OR M1 CROSSESBELOW L1 AND

M1 = MACD(TYPE=COMBO,DEFAULT=OSCILLATOR,BAR1=12,BAR2=26,OSC=9);

H1 = HIGHESTHIGH(M1,BARS=36);

L1 = LOWESTLOW(M1,BARS=36);

M1 CROSSESABOVE H1 OR M1 CROSSESBELOW L1

But some requirement like A new RSI move past 70 or
All time RSI high Or new price breakout while the monthly RSI already above 70 is not fullfil please edit my script as required.

Hi Mohd,

All variables have to be defined first, followed by the logic. Also, they must be unique (you are using M1, H1 and L1 twice). Try this:

```M1 = RSI(TYPE=RSI,BARS=14);
H1 = HIGHESTHIGH(M1,BARS=36);
L1 = LOWESTLOW(M1,BARS=36);

M2 = MACD(TYPE=COMBO,DEFAULT=OSCILLATOR,BAR1=12,BAR2=26,OSC=9);
H2 = HIGHESTHIGH(M2,BARS=36);
L2 = LOWESTLOW(M2,BARS=36);

(M1 CROSSESABOVE H1 OR M1 CROSSESBELOW L1)  or
(M2 CROSSESABOVE H2 OR M2 CROSSESBELOW L2)```

To include where RSI>70 you can add ‘and M1>70’ at the end.

Hi Darren,

Thanks for guide but the script of new price breakout while the monthly RSI already above 70 is missing in the script.

Hi Mohd,

See the last line:

To include where RSI>70 you can add ‘and M1>70’ at the end.