Help Drawing fib level lines

agent

New member
VIP
Hi all, this is too complicated for me, I need an indicator that uses the hi and low of the close of the 1st candle on the 5 minute chart. The indicator would draw a box or lines across the chart to the end of the day at the fib levels 61.8 and 38.2 based on the open and close of the 5 minute candle.

Thanks in advance for any help.

1698774368066.png
 
Hi all, this is too complicated for me, I need an indicator that uses the hi and low of the close of the 1st candle on the 5 minute chart. The indicator would draw a box or lines across the chart to the end of the day at the fib levels 61.8 and 38.2 based on the open and close of the 5 minute candle.

Thanks in advance for any help.

1698774368066.png
 

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

Hi all, this is too complicated for me, I need an indicator that uses the hi and low of the close of the 1st candle on the 5 minute chart. The indicator would draw a box or lines across the chart to the end of the day at the fib levels 61.8 and 38.2 based on the open and close of the 5 minute candle.

Thanks in advance for any help.

View attachment 20044

The fib plots will start after rangeEnd bar.
It will also work on chart's with timeframes ending before rangeEnd time. See image with a 1m example
There are various options at the input screen

Screenshot 2023-11-01 073244.png
Code:
#Auto Fib Levels After Bar @rangeEnd Closes
#Using Mobius' OR logic for Range
#Plots limited to RTHrs

input rangeStart    = 0930;
input rangeEnd      = 0935;
input ShowTodayOnly = no;

def A     = if SecondsTillTime(rangeEnd) > 0 and SecondsFromTime(rangeStart) >= 0
            then 1
            else 0;
def today = if ShowTodayOnly == no or
               GetDay() == GetLastDay() and  SecondsFromTime(rangeStart) >= 0
            then 1
            else 0;
def H     = if H[1] == 0 or
               A[1] == 0 and A == 1
            then high
            else if A and high > H[1]
            then high
            else H[1];
def L     = if L[1] == 0  or
               A[1] == 0 and A == 1
            then low
            else if A and low < L[1]
            then low
            else L[1];
def Range = H - L;

def HA    = if A or today < 1
            then Double.NaN
            else H;
def LA    = if A or today < 1
            then Double.NaN
            else L;


plot f382 = if SecondsFromTime(1600)[1] >= 0 or
              (SecondsFromTime(0000) > 0 and SecondsFromTime(rangeStart) < 0)
            then Double.NaN
            else LA + Range * .382;
plot f618 = if SecondsFromTime(1600)[1] >= 0 or
              (SecondsFromTime(0000) > 0 and SecondsFromTime(rangeStart) < 0)
            then Double.NaN
            else LA + Range * .618;
f382.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
f618.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

input bubble = yes;
input bubblemover = 3;
def b = bubblemover;
def b1 = b + 1;
AddChartBubble(bubble and IsNaN(f382[b]) and !IsNaN(f382[b1]), f382[b1], "38.2%\n" + AsDollars(f382[b1]), f382.TakeValueColor());
AddChartBubble(bubble and IsNaN(f618[b]) and !IsNaN(f618[b1]), f618[b1], "61.8%\n" + AsDollars(f618[b1]), f618.TakeValueColor());

#
 
The fib plots will start after rangeEnd bar.
It will also work on chart's with timeframes ending before rangeEnd time. See image with a 1m example
There are various options at the input screen
Wow SleepyZ thanks for the quick response and it works great.

Is it possible to plot the levels to the end of the current day as opposed to following the time of day? I use it as a support/resistance zone.
 
Wow SleepyZ thanks for the quick response and it works great.

Is it possible to plot the levels to the end of the current day as opposed to following the time of day? I use it as a support/resistance zone.

This will extend the lines to the end of the current day. You need to enter enough bars in chart settings/time axis/Expansion bars to the right to show the display in the image below.

Screenshot 2023-11-01 113543.png
Code:
#Auto Fib Levels After Bar @rangeEnd Closes
#Using Mobius' OR logic for Range
#Plots limited to RTHrs

input rangeStart    = 0930;
input rangeEnd      = 0935;
input ShowTodayOnly = no;

def A     = if SecondsTillTime(rangeEnd) > 0 and SecondsFromTime(rangeStart) >= 0
            then 1
            else 0;
def today = if ShowTodayOnly == no or
               GetDay() == GetLastDay() and  SecondsFromTime(rangeStart) >= 0
            then 1
            else 0;
def H     = if H[1] == 0 or
               A[1] == 0 and A == 1
            then high
            else if A and high > H[1]
            then high
            else H[1];
def L     = if IsNaN(low) then L[1] else if L[1] == 0  or
               A[1] == 0 and A == 1
            then low
            else if A and low < L[1]
            then low
            else L[1];

def Range = H - L;

def HA    = if A or today < 1
            then Double.NaN
            else H;

def LA    = if A or today < 1
            then Double.NaN
            else L;

def fib382 = if IsNaN(close) and SecondsTillTime(1600) > 0 then fib382[1]
             else if SecondsFromTime(1600)[1] >= 0 or
              (SecondsFromTime(0000) > 0 and SecondsFromTime(rangeStart) < 0)
            then Double.NaN
            else LA + Range * .382;
plot f382 = fib382;
f382.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
def fib618 = if IsNaN(close)  and SecondsTillTime(1600) > 0 then fib618[1]
             else if SecondsFromTime(1600)[1] >= 0 or
              (SecondsFromTime(0000) > 0 and SecondsFromTime(rangeStart) < 0)
            then Double.NaN
            else LA + Range * .618;
plot f618 = fib618;
f618.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

input bubble = yes;
input bubblemover = 3;
def b = bubblemover;
def b1 = b + 1;
AddChartBubble(bubble and IsNaN(f382[b]) and !IsNaN(f382[b1]) , f382[b1], "38.2%\n" + AsDollars(f382[b1]), f382.TakeValueColor());
AddChartBubble(bubble and IsNaN(f618[b]) and !IsNaN(f618[b1]), f618[b1], "61.8%\n" + AsDollars(f618[b1]), f618.TakeValueColor());

#
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
421 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