• Memorial Day Sale! Claim the biggest discount of the year with $50 off VIP using code MEM50. Sign up here.

Donchian Channel with Fibonacci Zone Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Here is the converted version of Fibonacci Zone on TradingView to ThinkorSwim. According to the developer, it was a Donchian Channel but instead of using the median line he added four Fibonacci lines.

xy09YQk.png


How to read the Fibonacci Zone:

  • Blue area is the uptrend zone
  • Grey area is the ranging zone
  • Orange area is the downtrend zone
  • Outside of the mentioned zones is in-betweens

thinkScript Code

Rich (BB code):
# WalkingBallista
# Converted from: https://www.tradingview.com/script/FDTcR7e9-Fibonacci-Zone/

input length = 21;

plot hl = highest(high, length);
plot ll = lowest(low, length);
def range = hl-ll;
plot hf = hl-range*0.236;
plot cfh = hl-range*0.382;
plot cfl = hl-range*0.618;
plot lf = hl-range*0.764;

DefineGlobalColor("Dark_Blue", createColor(0,0,100));
DefineGlobalColor("Dark_Orange", createColor(150,100,0));
DefineGlobalColor("Dark_Gray", Color.Dark_Gray);
AddCloud(cfh,cfl,GlobalColor("Dark_Gray"));
AddCloud(hl,hf, GlobalColor("Dark_Blue"), GlobalColor("Dark_Blue"));
AddCloud(ll, lf, GlobalColor("Dark_Orange"), GlobalColor("Dark_Orange"));

cfh.setDefaultColor(Color.Dark_Gray);
cfh.setLineWeight(2);
cfl.setDefaultColor(Color.Dark_Gray);
cfl.setLineWeight(2);
hl.setDefaultColor(Color.Blue);
hl.setLineWeight(2);
hf.setDefaultColor(Color.Blue);
hf.setLineWeight(2);
ll.setDefaultColor(GlobalColor("Dark_Orange"));
ll.setLineWeight(2);
lf.setdefaultColor(GlobalColor("Dark_Orange"));
lf.setLineWeight(2);

Shareable Link

https://tos.mx/apRWcv

Thanks to WalkingBallista for converting the script.
 
Last edited:

petergluis

Active member
https://www.tradingview.com/script/QE0LMwzk-Donchian-Channels/

Ruby:
def src_high = high;
def src_low = low;
def lkbk = 233;
def i_band_width =  8;
def top = Highest(src_high, lkbk);
def bottom = Lowest(src_low, lkbk);
def band_width = (top - bottom) / i_band_width;
def inner_top = top - band_width;
def inner_bottom = bottom + band_width;
plot p_top = top;
plot p_inner_top = inner_top;
plot p_inner_bottom = inner_bottom;
plot p_bottom = bottom;
AddCloud (p_top, p_inner_top, Color.RED, Color.RED);
AddCloud(p_bottom, p_inner_bottom, Color.BLUE, Color.BLUE);

def i_basis = yes;
def basis = (top + bottom)/2;
plot line = if i_basis then basis else Double.NaN;
def i_mid_top = yes;
def i_mid_bottom = yes;

def i_high_fib_786 = no;
def i_high_fib_705 = no;
def i_low_fib_382 = no;
def i_high_fib_382 = no;
def i_low_fib_705 = no;
def i_low_fib_786 = no;
def mid_top = (top + basis) / 2;
def mid_bottom = (bottom + basis) / 2;
def fib_calc = top - bottom;
def high_fib_786 = bottom + fib_calc * .786;
def high_fib_705 = bottom + fib_calc * .705;
def low_fib_382 = top - fib_calc * .382;
def high_fib_382 = bottom + fib_calc * .382;
def low_fib_705 = top - fib_calc * .705;
def low_fib_786 = top - fib_calc * .786;
plot p_high_fib_786 = if i_high_fib_786 then high_fib_786 else Double.NaN;
plot p_high_fib_705 =  if i_high_fib_705 then high_fib_705 else Double.NaN;
plot p_mid_top = if i_mid_top then mid_top else Double.NaN;
plot p_low_fib_382 = if i_low_fib_382 then  low_fib_382 else Double.NaN;
plot p_high_fib_382 = if i_high_fib_382 then high_fib_382 else Double.NaN;
plot p_mid_bottom = if i_mid_bottom then mid_bottom else Double.NaN;
plot p_low_fib_705 = if i_low_fib_705 then low_fib_705 else Double.NaN;
plot p_low_fib_786 = if i_low_fib_786 then low_fib_786 else Double.NaN;
AddCloud(p_top, p_high_fib_786, Color.YELLOW);
AddCloud(p_mid_top,  p_high_fib_705,  color.pink);
AddCloud(p_high_fib_382, p_low_fib_382, Color.LIME);
AddCloud(p_mid_bottom, p_low_fib_705, Color.BLUE);
AddCloud(p_bottom,  p_low_fib_786,  color.cyan);
 

Similar threads

Top