Fibonacci Retracement and Fibonacci Time Ratios Combined

Piotr

New member
Is it even possible to do the following;

in the case of an anticipated retrace, have input for high low for short or low high for long along with fib time ratios to draw on screen, all based on inputs? Is this beyond the scope of thinkscript's ability?

I found a fib retrace script on this site that automatically draws fibs based on the current day, or chart view, but it doesn't allow user input to determine fib start and end levels. https://usethinkscript.com/threads/auto-fib-fibonacci-levels-indicator-for-thinkorswim.14/ I have no expertise with thinkscript and can't figure out how to modify it for what i need.

it seems that the inputs would be standard 20 inputs for retracements and 12 for ratios. if anyone is unfamiliar with these tools they are available on the tool bar in tos, and when clicked, the dialog appears showing the inputs for each.

example; price from 0 to 100, standard hwb is 50, from 200 to 100, standard hwb 150. https://tlc.thinkorswim.com/center/reference/Drawings/Fibonacci/Fibonacci-Retracements
time ratiios are drawn from start of retrace period to end. https://tlc.thinkorswim.com/center/reference/Drawings/Fibonacci/Fibonacci-Time-Ratios.html

Any help would be greatly appreciated.

Thanks for reading the post!

piotr
 
Is it even possible to do the following;

in the case of an anticipated retrace, have input for high low for short or low high for long along with fib time ratios to draw on screen, all based on inputs? Is this beyond the scope of thinkscript's ability?

I found a fib retrace script on this site that automatically draws fibs based on the current day, or chart view, but it doesn't allow user input to determine fib start and end levels. https://usethinkscript.com/threads/auto-fib-fibonacci-levels-indicator-for-thinkorswim.14/ I have no expertise with thinkscript and can't figure out how to modify it for what i need.

it seems that the inputs would be standard 20 inputs for retracements and 12 for ratios. if anyone is unfamiliar with these tools they are available on the tool bar in tos, and when clicked, the dialog appears showing the inputs for each.

example; price from 0 to 100, standard hwb is 50, from 200 to 100, standard hwb 150. https://tlc.thinkorswim.com/center/reference/Drawings/Fibonacci/Fibonacci-Retracements
time ratiios are drawn from start of retrace period to end. https://tlc.thinkorswim.com/center/reference/Drawings/Fibonacci/Fibonacci-Time-Ratios.html

Any help would be greatly appreciated.

Thanks for reading the post!

piotr

This may give you some ideas of how to use thinkscript to manually create fib retracements at input choices similar to manually input of these in the TOS fib retracement tool.

It hopefully should flip the 0 to 100 to match the direction of the trendline.

Added is a Fib timeseries coded by Mobius. I do not use it and have not tried modifying it if it does not work properly.

Screenshot-2023-01-20-105438.png
Code:
input datefrom  = 20230119;
input dateto    = 20230119;
input timefrom  = 933;
input timeto    = 1139;
input pricefrom = high;
input priceto   = LOW;
def bn = BarNumber();
def na = Double.NaN;

def   linefrom = if GetYYYYMMDD() == datefrom and SecondsFromTime(timefrom) == 0 then pricefrom else 0;
def   lineto   = if GetYYYYMMDD() == dateto   and SecondsFromTime(timeto  ) == 0 then priceto else 0;

plot  line     = if linefrom
                 then pricefrom
                 else if lineto
                 then priceto
                 else na;
line.EnableApproximation();
line.SetDefaultColor(Color.WHITE);
line.SetLineWeight(3);

plot hi = max(highestall(linefrom),highestall(lineto));
plot lo = min(highestall(linefrom),highestall(lineto));

def range = AbsValue(hi - lo);

plot f236 = lo + range * .236;
plot f382 = lo + range * .382;
plot f500 = lo + range * .500;
plot f618 = lo + range * .618;
plot f764 = lo + range * .764;

input showbubbles = yes;
input bubblemover = 2;
def b  = bubblemover;
def b1 = b + 1;

def minbar = if timefrom < timeto and highestall(linefrom) > highestall(lineto) then 1 else 0 ;
def minb  = if minbar==0 then secondsfromtime(timeto) else secondsfromtime(timefrom);
addchartBubble(showbubbles and isnan(close[b]) and !isnan(close[b1]), hi[b], if minbar==1 then 100 else 0, hi.takeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), lo[b], if minbar == 1 then 0 else 100, lo.takevalueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), f236[b], if minbar == 1 then 236 else 764, f236.takevalueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), f382[b], if minbar == 1 then 382 else 618, f382.takeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), f618[b], if minbar == 1 then 618 else 382, f618.takeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), f500[b], if minbar == 1 then 500 else 500, f500.takevalueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), f764[b], if minbar == 1 then 764 else 236, f764.takevalueColor());

hi.setdefaultColor(color.white);
lo.setdefaultColor(color.white);
f236.setdefaultColor(color.cyan);
f764.setdefaultColor(color.cyan);
f500.setdefaultColor(color.white);
f382.setdefaultColor(color.yellow);
f618.setdefaultColor(color.yellow);

# Fibonacci Time Series by Mobius
rec bar1 = if GetYYYYMMDD() == dateto and secondsfromtime(timeto)==0
              then Bn
              else bar1[1];
rec bars = if BarNumber()[1] == bar1[1]
              then 2
              else if bn[1] > bar1[1] 
              then bars[1] + 1
              else 0;
def coeff = Sqrt(5);
def smallest = 5;
def n = Floor(Log(bars * coeff + 0.5) / Log((1 + Sqrt(5)) / 2));
def inSeries = n != n[1] and bars >= smallest;
def Series = if inSeries
                then bars
                else Double.NaN;
AddVerticalLine(secondsfromtime(timeto)>=0 and Series, "FTS: ( " + Series + ")", Color.gray, Curve.SHORT_DASH);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
361 Online
Create Post

Similar threads

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.
Back
Top