Convert Chande Kroll Stop to ThinkorSwim

lrc11239

lrc11239

Member
VIP
Hello All,

Would someone be able to convert a Chande Kroll Stop from TradingView to TOS? Many thanks in advance!

Code:
//@version=4
study(title = "Chande Kroll Stop", overlay=true, resolution="")
p = input(10, minval=1)
x = input(1, minval=1)
q = input(9, minval=1)
first_high_stop = highest(high, p) - x * atr(p)
first_low_stop = lowest(low, p) + x * atr(p)
stop_short = highest(first_high_stop, q)
stop_long = lowest(first_low_stop, q)
plot(stop_long, color=color.green)
plot(stop_short, color=color.red)
 
BenTen

BenTen

Administrative
Staff
VIP
Here you go:

Code:
# Chande Kroll Stop
# Converted by BenTen at UseThinkScript.com
# Original: https://www.tradingview.com/script/vMAD5SZT/
input p = 10;
input x = 1;
input q = 9;
def first_high_stop = highest(high, p) - x * atr(p);
def first_low_stop = lowest(low, p) + x * atr(p);
def stop_short = highest(first_high_stop, q);
def stop_long = lowest(first_low_stop, q);
plot st_long = stop_long;
plot st_short = stop_short;
 
lrc11239

lrc11239

Member
VIP
Thank you as always @BenTen !! I will try later tonight to make sure all is good.
 

Similar threads

Top