petergluis
Active member
Could you please check my code for Support and Resistance for ThinkorSwim? I converted Support and Resistance for ThinkorSwim. But it doesn't show in a right way.
https://www.tradingview.com/script/JWdq2Bni-RS-Support-and-Resistance-V0/
https://www.tradingview.com/script/JWdq2Bni-RS-Support-and-Resistance-V0/
Ruby:
def window1 = 8;
def window2 = 21;
def condition1 = high >= highest(high, window1);
def top1 = if condition1 then high else 0;
def condition2 =low <= lowest(low, window1);
def bot1 = if condition2 then low else 0;
def condition3 = high >= highest(high, window2);
def top2 = if condition3 then high else 0;
def condition4 = low <= lowest(low, window2);
def bot2 = if condition4 then low else 0;
plot t1 = top1;
plot b1 = bot1;
plot t2 = top2;
plot b2 = bot2;