modified version now:) + ema,sma option fixed
study("LRx2 MAx2",overlay=true) Len=input(200) LR_offset=input(0) ema= input(defval=false,title='use ema instead of sma?') show_2xMA = input(true) show_2xLR = input(true) ma1 = ema ? ema(high,Len) : sma(high,Len) ma2 = ema ? ema(low,Len) : sma(low,Len) plot(show_2xMA ? ma1:na,color=#6666ff, linewidth=2) plot(show_2xMA ? ma2: na,color=#6666ff, linewidth=2) z1=linreg(high,Len,LR_offset) z2=linreg(low,Len,LR_offset) col=z1>z1[1]? lime : red col2=z2>z2[1]? lime : red plot(show_2xLR ? z1 : na,color=col) plot(show_2xLR? z2 : na,color=col2)