# 90/120/180% lines on charts

#### darkelvis

##### Member
First off, I know NOTHING about coding, so any and all help is greatly appreciated here.
Is there any way to create an indicator that automatically plots lines at 90%, 120%, and 180% above yesterday's closing price on intraday charts?
Example... yesterday TRIL closed at \$1.46, so today it would have lines at \$2.77, \$3.21, and \$4.09.

Something along these lines:

Thanks in advance for any and all help!!

Part 2 of this question... If this indicator is possible, is there any way to create a scanner for stocks that are approaching the 90% line? (this isn't as important as the actual indicator though).

@darkelvis Here is your indicator (for intraday aggregation) with lines plotted at 90%, 120%, and 180% ABOVE yesterday's closing price. Note that TRIL closed at \$1.49 yesterday so the levels being plotted would be different from the level of \$1.46 you mentioned in your post. In either case the numbers would be very close. Loading this study on TRIL, lines are plotted at 2.83, 3.28 and 4.17. At the end of the day it's all math.

Additionally I have also added some labels for the previous day's close as well as all the 3 levels you wanted.

Code:
``````# Levels Based on Previous Daily Close
# tomsk
# 1.9.2020

declare hide_on_daily;

def PrevClose = close(period = AggregationPeriod.Day)[1];

plot level1 = PrevClose * 1.9;
plot level2 = PrevClose * 2.2;
plot level3 = PrevClose * 2.8;

level1.SetDefaultColor(Color.Cyan);
level2.SetDefaultColor(Color.White);
level3.SetDefaultColor(Color.Yellow);

AddLabel(1, "Previous Close = " + PrevClose, Color.Yellow);
AddLabel(1, "90% Above PC = " + Round(level1,2), Color.White);
AddLabel(1, "120% Above PC = " + Round(level2,2), Color.White);
AddLabel(1, "180% Above PC = " + Round(level3,2), Color.White);
# End Levels Based on Previous Daily Close``````

Interesting! Are those Gann levels? @darkelvis

Awesome @tomsk , thanks for that. and yeah, I saw after I posted that i was a little off on my close yesterday, but it got my point across. Again, THANK YOU THANK YOU THANK YOU THANK YOU.

@zeek, I'm primarily a scalper, if the volume is there on a stock that is ripping if it crosses 90% it will often hit 120%... if the volume and momentum are still there and it crosses 120% 180% is often the next stop. So, that said, instead of doing math while I am getting in and out of trades (my quickest trade today was 16 seconds), I want an indicator that automatically has those levels on my charts at all times.

Last edited:
@BenTen If you load that study up on to today's big runners (TRIL and AGTC) you can see that once it crossed 90% that the 90 and 120 lines act as a loose support and resistance

@BenTen If you load that study up on to today's big runners (TRIL and AGTC) you can see that once it crossed 90% that the 90 and 120 lines act as a loose support and resistance
So basically the 90 120 and 180 are the outer lines?

@darkelvis Here is your indicator (for intraday aggregation) with lines plotted at 90%, 120%, and 180% ABOVE yesterday's closing price. Note that TRIL closed at \$1.49 yesterday so the levels being plotted would be different from the level of \$1.46 you mentioned in your post. In either case the numbers would be very close. Loading this study on TRIL, lines are plotted at 2.83, 3.28 and 4.17. At the end of the day it's all math.

Additionally I have also added some labels for the previous day's close as well as all the 3 levels you wanted.

Code:
``````# Levels Based on Previous Daily Close
# tomsk
# 1.9.2020

declare hide_on_daily;

def PrevClose = close(period = AggregationPeriod.Day)[1];

plot level1 = PrevClose * 1.9;
plot level2 = PrevClose * 2.2;
plot level3 = PrevClose * 2.8;

level1.SetDefaultColor(Color.Cyan);
level2.SetDefaultColor(Color.White);
level3.SetDefaultColor(Color.Yellow);

AddLabel(1, "Previous Close = " + PrevClose, Color.Yellow);
AddLabel(1, "90% Above PC = " + Round(level1,2), Color.White);
AddLabel(1, "120% Above PC = " + Round(level2,2), Color.White);
AddLabel(1, "180% Above PC = " + Round(level3,2), Color.White);
# End Levels Based on Previous Daily Close``````
Hey Tom do you have a scrip that plots the outer and inner lines for the day? outer lines tend to be the pre market high and r/s levels on the daily chart and the inner lines are the intra day r/s levels.

@BenTen As you can see this strategy worked perfectly on CPAH today. Big momentum move this morning right trough 90%, up past 120% for a while. Volume dropped off and we went into a consolidation around 120%. Low volume plullback to the 90%, ended up forming an inverse head and shoulders with the shoulders at 90, the head slightly below and the neckline at 120. Volume came back in and in 3 minutes it shot from the 120 right through the 180.

@darkelvis Thank you for the follow up I will spend some more time on this over the weekend. Looks very cool.

@darkelvis Here is your indicator (for intraday aggregation) with lines plotted at 90%, 120%, and 180% ABOVE yesterday's closing price. Note that TRIL closed at \$1.49 yesterday so the levels being plotted would be different from the level of \$1.46 you mentioned in your post. In either case the numbers would be very close. Loading this study on TRIL, lines are plotted at 2.83, 3.28 and 4.17. At the end of the day it's all math.

Additionally I have also added some labels for the previous day's close as well as all the 3 levels you wanted.

Code:
``````# Levels Based on Previous Daily Close
# tomsk
# 1.9.2020

declare hide_on_daily;

def PrevClose = close(period = AggregationPeriod.Day)[1];

plot level1 = PrevClose * 1.9;
plot level2 = PrevClose * 2.2;
plot level3 = PrevClose * 2.8;

level1.SetDefaultColor(Color.Cyan);
level2.SetDefaultColor(Color.White);
level3.SetDefaultColor(Color.Yellow);

AddLabel(1, "Previous Close = " + PrevClose, Color.Yellow);
AddLabel(1, "90% Above PC = " + Round(level1,2), Color.White);
AddLabel(1, "120% Above PC = " + Round(level2,2), Color.White);
AddLabel(1, "180% Above PC = " + Round(level3,2), Color.White);
# End Levels Based on Previous Daily Close``````
Is there a way for these lines to be shorter like to the right of the chart verse across the whole chart ? If possible could you add that thanks

@Trading51 This could be incorporated into Plot Level1, 2, and 3. Give it a try, put it on your chart to see what it does. It's 30 bars ahead and 100 bars behind.
Code:
``````#  Posted from Mobius 1/15/18 - This puts a Horizontal Line at Price to see price level at potential Support / Resistance
#  Here is a code Snippet that gives you all you need to limit a line both forward and backward
# Dynamic_Line
# Mobius
# V01.09.2012
input LineLimit = 100;
input OnExpansion = yes;
input OnExpansionLimit = 30;
def c = close; # Replace close with any conditional value that meets your requirement
def barNumber = barNumber();
def bar = if IsNaN(c) then Double.NaN else BarNumber();
def ThisBar = HighestAll(bar);
def cline = if bar == ThisBar then c else Double.NaN;
def condi = CompoundValue(1, if IsNaN(c) then condi [1] else c, c);
plot P = if ThisBar - LineLimit <= bar then HighestAll (cLine) else Double.NaN;
P.SetStyle(Curve.Short_Dash);
P.SetLineWeight(1);
P.SetDefaultColor(CreateColor(75,250,150));
plot ExpLine = if OnExpansion and barNumber < HighestAll (bar + OnExpansionLimit) and IsNaN(c) then condi else Double.NaN;
ExpLine.SetStyle(Curve.Short_Dash);
ExpLine.SetLineWeight(1);
ExpLine.SetDefaultColor(CreateColor(150,150,150));
# End Code Dynamic Line Mobius • 8:23 PM``````

Last edited:
@Trading51 This could be incorporated into Plot Level1, 2, and 3. Give it a try, put it on your chart to see what it does. It's 30 bars ahead and 100 bars behind.
Code:
``````#  Posted from Mobius 1/15/18 - This puts a Horizontal Line at Price to see price level at potential Support / Resistance
#  Here is a code Snippet that gives you all you need to limit a line both forward and backward
# Dynamic_Line
# Mobius
# V01.09.2012
input LineLimit = 100;
input OnExpansion = yes;
input OnExpansionLimit = 30;
def c = close; # Replace close with any conditional value that meets your requirement
def barNumber = barNumber();
def bar = if IsNaN(c) then Double.NaN else BarNumber0;
def ThisBar = HighestAll(bar);
def cline = if bar == ThisBar then c else Double.NaN;
def condi = CompoundValue(1, if IsNaN(c) then condi [1] else c, c);
plot P = if ThisBar - LineLimit <= bar then HighestAll (cLine) else Double.NaN;
P.SetStyle(Curve.Short_Dash);
P.SetLineWeight(1);
P.SetDefaultColor(CreateColor(75,250,150));
plot ExpLine = if OnExpansion and barNumber < HighestAll (bar + OnExpansionLimit) and IsNaN(c) then condi else Double.NaN;
ExpLine.SetStyle(Curve.Short_Dash);
ExpLine.SetLineWeight(1);
ExpLine.SetDefaultColor(CreateColor(150,150,150));
# End Code Dynamic Line Mobius • 8:23 PM``````
line 12 has an error in the code

@darkelvis Here is your indicator (for intraday aggregation) with lines plotted at 90%, 120%, and 180% ABOVE yesterday's closing price. Note that TRIL closed at \$1.49 yesterday so the levels being plotted would be different from the level of \$1.46 you mentioned in your post. In either case the numbers would be very close. Loading this study on TRIL, lines are plotted at 2.83, 3.28 and 4.17. At the end of the day it's all math.

Additionally I have also added some labels for the previous day's close as well as all the 3 levels you wanted.

Code:
``````# Levels Based on Previous Daily Close
# tomsk
# 1.9.2020

declare hide_on_daily;

def PrevClose = close(period = AggregationPeriod.Day)[1];

plot level1 = PrevClose * 1.9;
plot level2 = PrevClose * 2.2;
plot level3 = PrevClose * 2.8;

level1.SetDefaultColor(Color.Cyan);
level2.SetDefaultColor(Color.White);
level3.SetDefaultColor(Color.Yellow);

AddLabel(1, "Previous Close = " + PrevClose, Color.Yellow);
AddLabel(1, "90% Above PC = " + Round(level1,2), Color.White);
AddLabel(1, "120% Above PC = " + Round(level2,2), Color.White);
AddLabel(1, "180% Above PC = " + Round(level3,2), Color.White);
# End Levels Based on Previous Daily Close``````
can you add it so it can be above the previous days high or low verse the close ?

This code doesn't work right even if you un click fit studies, could this get fixed and also have it produce these lines above or below the previous days high and low verse close, thanks

Before everyone jumps up and down and gets all excited about this code, note that the study that I coded for @darkelvis is best used for stocks that has made at least a 2 standard deviation move, e.g. TRIL and CPAH. Using that study on a slow moving stock or stocks that do not spike will display lines outside those levels. A better question might be to gently ask @darkelvis his secret sauce how he managed to uncover those stocks prior to those moves.

This sort of phenomenon is similar to one of John Carter's trading strategies surrounding a post earnings move where he looks for a minimum of 1.5 to 2 standard deviation move after an earnings announcement to catch moves like this. I've even used his strategy a couple of times, man that was real fun!

Last edited:
@Trading51 This could be incorporated into Plot Level1, 2, and 3. Give it a try, put it on your chart to see what it does. It's 30 bars ahead and 100 bars behind.
Code:
``````#  Posted from Mobius 1/15/18 - This puts a Horizontal Line at Price to see price level at potential Support / Resistance
#  Here is a code Snippet that gives you all you need to limit a line both forward and backward
# Dynamic_Line
# Mobius
# V01.09.2012
input LineLimit = 100;
input OnExpansion = yes;
input OnExpansionLimit = 30;
def c = close; # Replace close with any conditional value that meets your requirement
def barNumber = barNumber();
def bar = if IsNaN(c) then Double.NaN else BarNumber0;
def ThisBar = HighestAll(bar);
def cline = if bar == ThisBar then c else Double.NaN;
def condi = CompoundValue(1, if IsNaN(c) then condi [1] else c, c);
plot P = if ThisBar - LineLimit <= bar then HighestAll (cLine) else Double.NaN;
P.SetStyle(Curve.Short_Dash);
P.SetLineWeight(1);
P.SetDefaultColor(CreateColor(75,250,150));
plot ExpLine = if OnExpansion and barNumber < HighestAll (bar + OnExpansionLimit) and IsNaN(c) then condi else Double.NaN;
ExpLine.SetStyle(Curve.Short_Dash);
ExpLine.SetLineWeight(1);
ExpLine.SetDefaultColor(CreateColor(150,150,150));
# End Code Dynamic Line Mobius • 8:23 PM``````

@markos Noticed you had an error in the study you posted above - perhaps you may not have stored the original study in NotePad but used some sort of word processor? At any rate, suggest you replace that line before anyone else gets to it as many people on this site are dependent on code that is posted

Replace
Code:
``def bar = if IsNaN(c) then Double.NaN else BarNumber0;``

with
Code:
``def bar = if IsNaN(c) then Double.NaN else BarNumber();``

Please anyone looking at this study make sure you understand what it is plotting. "lines plotted at 90%, 120%, and 180% ABOVE yesterday's closing price " Now would you expect a higher price stock to be able to move that much. Say it closed at \$100 that first line will be at \$190. Seems to me this would be most useful on penny stocks. Possibly darkelvis can inform everyone on what price stocks he uses this.

87k+ Posts
395 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?