Plot 1hour Fibonacci Retracement lines on any timeframe

Z

zeek

Member
VIP
Hi guys, i like to use Fib retracement lines to find areas of support and resistance and i have been thinking about an idea for a while and wanted to ask if its possible to make a script for this. What i am looking for is basically a script that plots the Fib retracement lines but not based on the current selected timeframe but rather i would like the script to plot the Fib lines based on the highest high & lowest low on the 1 hour timeframe and going back 180 days. And i want these line to show on any timeframe i select on a chart.

So in the example pic i attached, i want these Fib lines for BYND on the 1hour timeframe going 180 days back in time to show on a 3min timeframe for example.

Can this be done?

 
Z

zeek

Member
VIP
Given the lack of response, i am guessing this is not possible to do. Too bad 😞
 
J

john3

Member
VIP
Warehouse
Strange page, but there is a code on it that plots what you want on 4-hours. You can change it to 1 hour.

Code:
# CopyCode
#
# cisRxSESSIONS
# Corum Integrated Solutions Inc
# GreatGatsbyProTrader Solution Series
# RxSERIES
#
# Joshua Corum (c) 2009-2017
#
declare upper;
# CopyCode
def HLRANGE = high – low;
def RANGE = High(period = AggregationPeriod.FOUR_HOURS)[1] – low(period = AggregationPeriod.FOUR_HOURS)[1];
def HLR21 = ExpAverage(HLRANGE, AggregationPeriod.HOUR)[1];
def HLR3 = ExpAverage (HLRANGE, AggregationPeriod.HOUR)[1];
# CorumIntegratedSolutions.com
def Rx= hlc3(period=AggregationPeriod.FOUR_HOURS)[1];
# thinkorswimTOOLKIT.com
plot BALANCE = hl2(period=AggregationPeriod.FOUR_HOURS)[1];
BALANCE.SetPaintingStrategy (paintingstrategy.DASHES);
BALANCE.SetDefaultColor (Color.DARK_GRAY);
BALANCE.SetLineWeight (2);
# youtube.com/user/cisTRADING
plot UPPER_Band=BALANCE+RANGE*.5;
UPPER_Band.SetPaintingStrategy (paintingstrategy.DASHES);
UPPER_Band.SetDefaultColor (Color.GREEN);
UPPER_Band.SetLineWeight (1);
plot LOWER_Band=BALANCE-RANGE*.5;
LOWER_Band.SetPaintingStrategy (paintingstrategy.DASHES);
LOWER_Band.SetDefaultColor (Color.BLUE);
LOWER_Band.SetLineWeight (1);
plot UPPER_R=BALANCE+RANGE*.5+ HLR3;
UPPER_R.SetPaintingStrategy (paintingstrategy.DASHES);
UPPER_R.SetDefaultColor (Color.GREEN);
UPPER_R.SetLineWeight (1);
plot LOWER_R=BALANCE-RANGE*.5-HLR3;
LOWER_R.SetPaintingStrategy (paintingstrategy.DASHES);
LOWER_R.SetDefaultColor (Color.BLUE);
LOWER_R.SetLineWeight (1);
# thinkscriptTHINKORSWIM.com
plot UPPER_x=BALANCE+ HLR21;
UPPER_x.SetPaintingStrategy (paintingstrategy.DASHES);
UPPER_x.SetDefaultColor (Color.GREEN);
UPPER_x.SetLineWeight (1);
plot LOWER_x=BALANCE-HLR21;
LOWER_x.SetPaintingStrategy (paintingstrategy.DASHES);
LOWER_x.SetDefaultColor (Color.BLUE);
LOWER_x.SetLineWeight (1);
# JoshuaCorum.com
# PasteCode
Source
 
Last edited by a moderator:
H

horserider

Well-known member
VIP
Warehouse
Why is it four hour and then these lines say .HOUR ?
def HLR21 = ExpAverage(HLRANGE, AggregationPeriod.HOUR)[1];
def HLR3 = ExpAverage (HLRANGE, AggregationPeriod.HOUR)[1];

It appears this line does nothing.
def Rx= hlc3(period=AggregationPeriod.FOUR_HOURS)[1];

Please clarify. Thank you.
 
J

john3

Member
VIP
Warehouse
Here is another option. Plots the levels on any candle.

Code:
#Code by BLT
def last = if isnan(close[-1]) and !isnan(close) then barnumber() else last[1];
def hilo = if hl2 then barnumber() else hilo[1];

def cond = if barNumber() == hilo then barNumber()-1 else double.nan;
def pbar = if barNumber() >= HighestAll(cond) and !last then 1 else double.nan;

input show50 = yes;
plot HalfBack = if show50 and !isnan(pbar) then hl2 else double.nan;
HalfBack.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
HalfBack.SetDefaultColor(color.Yellow);
HalfBack.SetLineWeight(3);
def hbext    = if isnan(halfback) then hbext[1] else halfback;
plot hbextline = hbext;
hbextline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
hbextline.SetDefaultColor(color.Yellow);
hbextline.SetLineWeight(3);

input show75 = yes;
plot Back75 = if show75 and !isnan(pbar) then low+(high-low)*.75 else double.nan;
Back75.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Back75.SetDefaultColor(color.white);
Back75.SetLineWeight(1);

input show25 = yes;
plot Back25 = if show25 and !isnan(pbar) then low+(high-low)*.25 else double.nan;
Back25.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Back25.SetDefaultColor(color.white);
Back25.SetLineWeight(1);

input bubblemover = 1;
def n1 = bubblemover + 1;
input showbubble_candle    = no;
input showbubble_expansion = no;
addchartBubble(showbubble_candle and barnumber()==highestall(last-1),high,"H: " +high,color.white,yes);
addchartBubble(showbubble_candle and barnumber()==highestall(last-1),low,"L: " +low,color.white,no);
addchartBubble(showbubble_expansion and isnan(close[bubblemover]) and !isnan(close[n1]),high[n1+1],"H: " +high[n1+1],color.white,yes);
addchartBubble(showbubble_expansion and isnan(close[bubblemover]) and !isnan(close[n1]),low[n1+1],"L: " +low[n1+1],color.white,no);
def h1 = if isnan(close) then h1[1] else high[1];
plot h1p = if barnumber()>=highestall(last) then h1 else double.nan;
h1p.setpaintingStrategy(PaintingStrategy.HORIZONTAL);
h1p.setdefaultColor(color.white);
input showcolor_light_gray = yes;
h1p.assignvalueColor(if showcolor_light_gray then color.light_gray else color.white);
def l1 = if isnan(close) then l1[1] else low[1];
plot l1p = if barnumber()>=highestall(last) then l1 else double.nan;
l1p.setpaintingStrategy(PaintingStrategy.HORIZONTAL);
l1p.setdefaultColor(color.white);
l1p.assignvalueColor(if showcolor_light_gray then color.light_gray else color.white);
 
Last edited by a moderator:

Top