Low To High ZigZag Daily to Plot on any timeframe.

nitrous

Member
Low To High ZigZag
Is there an indicator that helps draw the daily levels (say for the last 1 year) of the previous swings high and swings low, on a current chart that is set for either any time frame, apart from daily itself.

Thanks
 
Last edited by a moderator:
Solution
@nitrous @vro3 @Pumper @007sakura
Regrettably, plotting horizontal lines in TOS requires a separate plot for each line. So your request is a very manual process to create.

The following code plots 3 sets of daily high/low lines using a script as a basis. All the lines are extended to the right. You can create more plots using the logic between the 3 sets of plots and associated coloring.

Ruby:
#Example_PreviousDaysHL-each_extended_through_expansion
#20170911 - BLT
#Example Highs/Lows from previous days, extended from each day through the right expansion
script philow {
    input n = 1;
    def ymd = GetYYYYMMDD();
    def ok = !IsNaN(close);
    def capture = ok and ymd != ymd[1];
    def dayCount =...

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

Thanks.

Basically looking for an indicator that:

1.) plots the extreme swing highs and lows on the daily chart

2.) then plot lines between the above levels (swing high/low) where price reacted to multiple times (basically support and resistance lines) on the daily chart as well.

Both the above need to be viewable on say the 1,5,15 etc mins chart.
 
Thanks.

Basically looking for an indicator that:

1.) plots the extreme swing highs and lows on the daily chart

2.) then plot lines between the above levels (swing high/low) where price reacted to multiple times (basically support and resistance lines) on the daily chart as well.

Both the above need to be viewable on say the 1,5,15 etc mins chart.
Swing high swing low
i came here to look for the same thing! you going through ICT videos?
 
Last edited by a moderator:
I see there are indicators for previous day high low. But I'm looking for an indicator that goes back.. For months, even years. And plots all the daily high and lows today. So lots of LONG horizontal lines
 
Last edited:
@nitrous @vro3 @Pumper @007sakura
Regrettably, plotting horizontal lines in TOS requires a separate plot for each line. So your request is a very manual process to create.

The following code plots 3 sets of daily high/low lines using a script as a basis. All the lines are extended to the right. You can create more plots using the logic between the 3 sets of plots and associated coloring.

Ruby:
#Example_PreviousDaysHL-each_extended_through_expansion
#20170911 - BLT
#Example Highs/Lows from previous days, extended from each day through the right expansion
script philow {
    input n = 1;
    def ymd = GetYYYYMMDD();
    def ok = !IsNaN(close);
    def capture = ok and ymd != ymd[1];
    def dayCount = CompoundValue(1, if capture
                                    then dayCount[1] + 1
                                    else dayCount[1], 0);
    def thisDay = (HighestAll(dayCount) - dayCount) ;
    def hh = CompoundValue(1, if thisDay == n and SecondsFromTime(0930) == 0
                              then high
                              else if thisDay == n and  high > hh[1]
                              then high
                              else hh[1] , high);
    def hhnan = if IsNaN(close) then hhnan[1] else hh;
    plot hhplot = if thisDay == n and SecondsFromTime(0930) < 0
                  then Double.NaN
                  else if thisDay <= n
                  then hhnan
                  else Double.NaN;

    def ll = CompoundValue(1, if thisDay == n and SecondsFromTime(0930) == 0
                              then low
                              else if  thisDay == n and low < ll[1]
                              then low
                              else ll[1] , low);
    def llnan   = if IsNaN(ll) then llnan[1] else ll;
    plot llplot = if thisDay == n and SecondsFromTime(0930) < 0
                  then Double.NaN
                  else if thisDay <= n
                  then (llnan)
                  else Double.NaN;
}

#Plots of Highs/Lows based upon script...add more days using similar plot statements, increasing the value by 1
plot H1 = philow(1);
plot H2 = philow(2);
plot H3 = philow(3);

plot L1 = philow(1).llplot;
plot L2 = philow(2).llplot;
plot L3 = philow(3).llplot;

defineGlobalColor("H",color.red);
defineGlobalColor("L",color.green);
H1.setdefaultColor(globalColor("H"));
H2.setdefaultColor(globalColor("H"));
H3.setdefaultColor(globalColor("H"));

L1.setdefaultColor(globalColor("L"));
L2.setdefaultColor(globalColor("L"));
L3.setdefaultColor(globalColor("L"));
 
Last edited by a moderator:
Solution
@nitrous @vro3 @Pumper @007sakura
Regrettably, plotting horizontal lines in TOS requires a separate plot for each line. So your request is a very manual process to create.

The following code plots 3 sets of daily high/low lines using a script as a basis. All the lines are extended to the right. You can create more plots using the logic between the 3 sets of plots and associated coloring.
Hey @SleepyZ - Any chance it would be possible to have this code use an aggregate rather than being specific for the last 3 days? In other words, so it could look back for the last 3 hourly candles, or last 3 15min candles?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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