Script to Input fixed price lines

eulin87

Member
Part of my strategy is finding significant levels while on a line chart. The issue is when I have the lines plotted and Im drawing a zone or trend line, I might accidentally move the price line so I'm looking for script that will allow me to input any levels I would want so that it may be fixed to the chart so I don't accidentally move it or delete it. Thank You!

Screen-Shot-2022-09-04-at-8-54-06-AM.png
 
Solution
to input decimal numbers, add .0 to default number ( or some desired number)
input line1 = 1.0;

you need a plot function for every separate object to be plotted
Ah ok! Thanks! Well here is the code with ten inputs to get anyone started. Thanks again for all the help y'all.!

Code:
input line1 = 1.0;
plot pline1 = line1;
input line2 = 2.0;
plot pline2 = line2;
input line3 = 3.0;
plot pline3 = line3;
input line4 = 4.0;
plot pline4 = line4;
input line5 = 5.0;
plot pline5 = line5;
input line6 = 6.0;
plot pline6 = line6;
input line7 = 7.0;
plot pline7 = line7;
input line8 = 8.0;
plot pline8 = line8;
input line9 = 9.0;
plot pline9 = line9;
input line10 = 10.0;
plot pline10 = line10;


pline1.SetPaintingStrategy(PaintingStrategy.LINE)...
Part of my strategy is finding significant levels while on a line chart. The issue is when I have the lines plotted and Im drawing a zone or trend line, I might accidentally move the price line so I'm looking for script that will allow me to input any levels I would want so that it may be fixed to the chart so I don't accidentally move it or delete it. Thank You!

Screen-Shot-2022-09-04-at-8-54-06-AM.png

The inputs for Supply /Demand in the candle code you revised will work. You create as many as you need.
 
The inputs for Supply /Demand in the candle code you revised will work. You create as many as you need.

So this is what I got so far. Switched the lines but not sure why im not able to input any decimals. Just able to input whole numbers. Also, is there a way to code it where all the lines are the same instead of having to do "Pline1, pline2, pline3 " etc.

Code:
input line1 = 0;
plot pline1 = line1;
input line2 = 1;
plot pline2 = line2;



pline1.SetPaintingStrategy(PaintingStrategy.LINE);
pline1.SetDefaultColor(Color.GRAY);
pline1.SetStyle(CURVE.SHORT_DASH);
pline1.SetLineWeight(1);



pline2.SetPaintingStrategy(PaintingStrategy.LINE);
pline2.SetDefaultColor(Color.GRAY);
pline2.SetStyle(CURVE.SHORT_DASH);
pline2.SetLineWeight(1);

Screen-Shot-2022-09-04-at-2-18-19-PM.png

Screen-Shot-2022-09-04-at-2-18-42-PM.png
 
Part of my strategy is finding significant levels while on a line chart. The issue is when I have the lines plotted and Im drawing a zone or trend line, I might accidentally move the price line so I'm looking for script that will allow me to input any levels I would want so that it may be fixed to the chart so I don't accidentally move it or delete it. Thank You!

maybe this will help...
this thread has many posts about setting price level lines , and some for a specific stock, like this post.
https://usethinkscript.com/threads/horizontal-lines-in-thinkorswim.3472/page-2#post-39095
 
So this is what I got so far. Switched the lines but not sure why im not able to input any decimals. Just able to input whole numbers. Also, is there a way to code it where all the lines are the same instead of having to do "Pline1, pline2, pline3 " etc.

input line1 = 0;

to input decimal numbers, add .0 to default number ( or some desired number)
input line1 = 1.0;

you need a plot function for every separate object to be plotted
 
to input decimal numbers, add .0 to default number ( or some desired number)
input line1 = 1.0;

you need a plot function for every separate object to be plotted
Ah ok! Thanks! Well here is the code with ten inputs to get anyone started. Thanks again for all the help y'all.!

Code:
input line1 = 1.0;
plot pline1 = line1;
input line2 = 2.0;
plot pline2 = line2;
input line3 = 3.0;
plot pline3 = line3;
input line4 = 4.0;
plot pline4 = line4;
input line5 = 5.0;
plot pline5 = line5;
input line6 = 6.0;
plot pline6 = line6;
input line7 = 7.0;
plot pline7 = line7;
input line8 = 8.0;
plot pline8 = line8;
input line9 = 9.0;
plot pline9 = line9;
input line10 = 10.0;
plot pline10 = line10;


pline1.SetPaintingStrategy(PaintingStrategy.LINE);
pline1.SetDefaultColor(Color.LIGHT_GRAY);
pline1.SetStyle(CURVE.SHORT_DASH);
pline1.SetLineWeight(1);

pline2.SetPaintingStrategy(PaintingStrategy.LINE);
pline2.SetDefaultColor(Color.LIGHT_GRAY);
pline2.SetStyle(CURVE.SHORT_DASH);
pline2.SetLineWeight(1);

pline3.SetPaintingStrategy(PaintingStrategy.LINE);
pline3.SetDefaultColor(Color.LIGHT_GRAY);
pline3.SetStyle(CURVE.SHORT_DASH);
pline3.SetLineWeight(1);

pline4.SetPaintingStrategy(PaintingStrategy.LINE);
pline4.SetDefaultColor(Color.LIGHT_GRAY);
pline4.SetStyle(CURVE.SHORT_DASH);
pline4.SetLineWeight(1);

pline5.SetPaintingStrategy(PaintingStrategy.LINE);
pline5.SetDefaultColor(Color.LIGHT_GRAY);
pline5.SetStyle(CURVE.SHORT_DASH);
pline5.SetLineWeight(1);

pline6.SetPaintingStrategy(PaintingStrategy.LINE);
pline6.SetDefaultColor(Color.LIGHT_GRAY);
pline6.SetStyle(CURVE.SHORT_DASH);
pline6.SetLineWeight(1);

pline7.SetPaintingStrategy(PaintingStrategy.LINE);
pline7.SetDefaultColor(Color.LIGHT_GRAY);
pline7.SetStyle(CURVE.SHORT_DASH);
pline7.SetLineWeight(1);

pline8.SetPaintingStrategy(PaintingStrategy.LINE);
pline8.SetDefaultColor(Color.LIGHT_GRAY);
pline8.SetStyle(CURVE.SHORT_DASH);
pline8.SetLineWeight(1);

pline9.SetPaintingStrategy(PaintingStrategy.LINE);
pline9.SetDefaultColor(Color.LIGHT_GRAY);
pline9.SetStyle(CURVE.SHORT_DASH);
pline9.SetLineWeight(1);

pline10.SetPaintingStrategy(PaintingStrategy.LINE);
pline10.SetDefaultColor(Color.LIGHT_GRAY);
pline10.SetStyle(CURVE.SHORT_DASH);
pline10.SetLineWeight(1);

Screen-Shot-2022-09-04-at-3-01-25-PM.png

Screen-Shot-2022-09-04-at-3-01-50-PM.png
 
Last edited:
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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