script required

can you provide me with script of range breakout of last 8 bars highest range bar ie high- minus low of that bar maximum among last 8 bars , also last 2-3 bar not overlapping and close above 50 moving average