Donchian Channel with Fibonacci Zone Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
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

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Top