How do I take One Point of Linear Regression Slope and Have it divide it by closing price of that candle

uunnamed

New member
It's my first time trying to write a script but I Just can't figure it out how it works

I am trying to use the default LinearRegressionSlope script on tos
and have it divide by the closing price on the 1minute-time frame

The trouble I face is that the default script is set for a length of time,
Instead of 1 minute value

And I just need to use that 1minute value to divide by price

Sorry if it is unclear,
Thanks for the help
 
Solution
hello and welcome.
questions about a code that you don't post, are hard to answer.
don't be bashful, post the code you have.

what 1 minute value you want to read? every bar ? or just the last bar?
the plot of LRS has a value on every bar, in a lower chart.


Code:
# LinearRegressionSlope

declare lower;

input price = close;
input length = 14;

Assert(length > 1, "'length' must be greater than one: " + length);

plot LRS = 6 * ( wma(price, length) -  Average(price, length) ) / (length - 1);
plot ZeroLine = 0;

LRS.setDefaultColor(getColor(8));
ZeroLine.setDefaultColor(getColor(5));
I think I figured it out lol
I was dividing it by the wrong unit
It's my first time trying to write a script but I Just can't figure it out how it works

I am trying to use the default LinearRegressionSlope script on tos
and have it divide by the closing price on the 1minute-time frame

The trouble I face is that the default script is set for a length of time,
Instead of 1 minute value

And I just need to use that 1minute value to divide by price

Sorry if it is unclear,
Thanks for the help

hello and welcome.
questions about a code that you don't post, are hard to answer.
don't be bashful, post the code you have.

what 1 minute value you want to read? every bar ? or just the last bar?
the plot of LRS has a value on every bar, in a lower chart.


Code:
# LinearRegressionSlope

declare lower;

input price = close;
input length = 14;

Assert(length > 1, "'length' must be greater than one: " + length);

plot LRS = 6 * ( wma(price, length) -  Average(price, length) ) / (length - 1);
plot ZeroLine = 0;

LRS.setDefaultColor(getColor(8));
ZeroLine.setDefaultColor(getColor(5));
 
hello and welcome.
questions about a code that you don't post, are hard to answer.
don't be bashful, post the code you have.

what 1 minute value you want to read? every bar ? or just the last bar?
the plot of LRS has a value on every bar, in a lower chart.


Code:
# LinearRegressionSlope

declare lower;

input price = close;
input length = 14;

Assert(length > 1, "'length' must be greater than one: " + length);

plot LRS = 6 * ( wma(price, length) -  Average(price, length) ) / (length - 1);
plot ZeroLine = 0;

LRS.setDefaultColor(getColor(8));
ZeroLine.setDefaultColor(getColor(5));
I think I figured it out lol
I was dividing it by the wrong unit
 
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
419 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