I'm trying to find a way to scan for stocks that have a positive TTM Lrc slope. I've tried using LinearRegressionSlope and copying some scripts I've found during my exhausting search to no avail.
Question: How do go about finding the slope of TTM Lrc?
I'm trying to find a way to scan for stocks that have a positive TTM Lrc slope. I've tried using LinearRegressionSlope and copying some scripts I've found during my exhausting search to no avail.
Question: How do go about finding the slope of TTM Lrc?
The following InertiaLine uses the TOS inertiaall() function. It might help you determine the positive/negative direction as the TTM LRC code is not available to provide this.
The InertiaLine is set to the same close/length as the TTM LRC and is the wide cyan colored line overlaid on the TTM LRC indicator's plots in the image below for comparison.
A label was added to determine the direction of the InertiaLine by comparing the current bar to the...
I'm trying to find a way to scan for stocks that have a positive TTM Lrc slope. I've tried using LinearRegressionSlope and copying some scripts I've found during my exhausting search to no avail.
Question: How do go about finding the slope of TTM Lrc?
The following InertiaLine uses the TOS inertiaall() function. It might help you determine the positive/negative direction as the TTM LRC code is not available to provide this.
The InertiaLine is set to the same close/length as the TTM LRC and is the wide cyan colored line overlaid on the TTM LRC indicator's plots in the image below for comparison.
A label was added to determine the direction of the InertiaLine by comparing the current bar to the prior bar.
Code:
input data = close;
input length = 38;
plot InertiaLline = inertiaall(data, length);
addlabel(1, if InertiaLline > InertiaLline[1] then "UP" else "DN", if InertiaLline > InertiaLline[1] then color.green else color.red);
I'm trying to find a way to scan for stocks that have a positive TTM Lrc slope. I've tried using LinearRegressionSlope and copying some scripts I've found during my exhausting search to no avail.
Question: How do go about finding the slope of TTM Lrc?
to find a slope, you look for a change in y over a change in x.
(y-y) / (x-x)
a change in price, over x bars.
then reduce it down to a price change over 1 bar.
the space between 2 adjacent bars is 1.
lrc is a straight line, so the change between the last 2 bars will work.
if what you want is to know if a straight line is inclining or declining, then subtract the previous price from the current price.
then check if the number is > 0.
here is a simple formula, for reading the LR plot.
you use the study name, () , then a period, and the plot name.
def lrc = TTM_LRC().LR;
i included all the input parameters in my study, so it can be setup as desired.
then compare 2 values,
def lrc_slope = lrc - lrc[1];
this is a lower study for testing. but will work as a scan
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.
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.