Magic Fibonacci 1.272 Indicator for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
Warehouse
This Fibonacci indicator was inspired by a day trader on Twitter (@pierhk). He traces his fibs "the unconventional way" by connecting the close of the previous day with the close of the first opening bar from the current trading day. He often does it on the 5m timeframe to find resistance and use it as profit target.

A few chart examples:





Before using this indicator, I recommend checking out some educational videos created by @pierhk to help you understand his thought process when tracing the Fibonacci extension 1.272.

thinkScript Code

Code:
# Magic Fibonacci 1.272
# Author: Kory Gill, @korygill
# Gap feature modfied by WalkingBallista

declare upper;
declare Hide_On_Daily;
declare once_per_bar;

def vClose = close;
def nan = Double.NaN;

# logic
def day = GetDay();
def firstBarOfDay = day != day[1];
def dayOpen = if firstBarOfDay then vClose else dayOpen[1];
def prevDayClose = if firstBarOfDay[-1] then vClose else prevDayClose[1];

# Gap feature added by @korygill and modified by @WalkingBallista
# track data necessary to calculate if this is a gapUp or gapDown day
def time = GetDay();
def previousClose = if time != time[1] then close[1] else previousClose[1];
def dayOpen1 = if time != time[1] then open else dayOpen1[1];
def dayLow = if time != time[1] then low else dayLow[1];
def dayHigh = if time != time[1] then high else dayHigh[1];
def gapUp = if dayLow > previousClose then 1 else 0;
def gapDown = if dayHigh < previousClose then 1 else 0;

# fibs
def delta = dayOpen - prevDayClose;
def fib000 = prevDayClose;
def fib1272 = prevDayClose + delta * 1.272;

# colors, see https://usethinkscript.com/threads/rainbow-indicators-%E2%80%93-bb-and-moving-average.294/
def pFib1272 = if firstBarOfDay[-1] then nan else fib1272;
plot fib = if gapUp then pFib1272 else double.NaN;
fib.SetDefaultColor(CreateColor(0,0,255));
plot fibGapDown = if gapDown then pFib1272 else double.NaN;
fibGapDown.SetDefaultColor(CreateColor(0,0,255));

Shareable Link


Credits:
  • @korygill
  • @pierhk
  • @WalkingBallista
 
Last edited:
tenacity11

tenacity11

Member
VIP
This is very interesting. I've been using 127.2 for years in my pattern trading as the sq root of 1.618 but this way of figuring is most interesting.
 
J

john3

New member
VIP
Warehouse
@BenTen. I have watched several of his videos. Have you found the one in which he explains the rationale for doing this? In addition, his fibs indicator seems to be plotting more than just the 1.272 target. Do you have the code for his fibs plot by any chance? Thank you.
 
BenTen

BenTen

Administrative
Staff
VIP
Warehouse
@john3 Aside from the fact that it’s a sq root of the other fib like @tenacity11 mentioned earlier I have yet too see any other. The guy drew his Fibs manually using the Fib drawing tool which usually also plot other Fiboacci. But his main focus is always on the 1.272 I believe.
 
S

sindhu19

New member
VIP
I find if you use this and have extended hours 'on', the 1.272 fibs are not aligned.
 
BenTen

BenTen

Administrative
Staff
VIP
Warehouse
@sindhu19 I would disable extended hours in this case.
 
H

horserider

Active member
Warehouse
Is it magic ? What does everyone think Magic Fibonacci is based upon? If VIP members already know, no fair playing.

 
J

JiChul

New member
VIP
Hi @BenTen,
Thank you for posting this. If you get a chance, can you please write another version? Instead of using "close" to calculate delta for all opening bars, use "open" depending on if the opening bar is up or down as following. I couldn't figure out how to do it myself.

If gap up + up candle opening bar => use close
If gap up + down candle opening bar => use open

If gap down + down candle opening bar => use close
If gap down + up candle opening bar => use open

Thank you,
JC.
 
AGD

AGD

New member
The other day, somebody posted backtesting code. Please share again.
 
BenTen

BenTen

Administrative
Staff
VIP
Warehouse
@AGD there is no backtesting code for this one. But you can build your own.
 

Top