NexusFi: Find Your Edge


Home Menu

 





Linear Regression Slope Angle Label


Discussion in ThinkOrSwim

Updated
    1. trending_up 3,222 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
madeinnyc
Highland Park, TX
 
Posts: 36 since Jan 2020
Thanks Given: 17
Thanks Received: 20

I slightly modified this linear regression slop study to include an angle label. I'm looking to further improve it by adding another angle label that changes the angel value as I hover my pointer over the slope line. Can someone please help:


 
Code
declare lower;

input price = close;
input length = 14;
input displace = 0;
def avg = ExpAverage(close, length);
def height = avg - avg[length];
def Angle_deg = ATan(height/length) * 180 / Double.Pi;
addLabel(1, "Angle Deg " + Angle_deg, Color.WHITE);


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));


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Irans Answer Due Today: Peace Surges to 33.5%, Invasion …
Prediction Markets & Event Contracts
The 50/50 Paradox: Peace and Invasion Each at 20% -- Ira …
Prediction Markets & Event Contracts
Iran Deal "In Review" at 87% on Deadline Day - …
Prediction Markets & Event Contracts
CFTC Approves First US Bitcoin Perpetual Futures -- Kals …
Traders Hideout
June 15 Peace Odds Surge From 3.6% to 12.25% After Trump …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
13 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #2 (permalink)
VanDriver
Jackson, MS
 
Posts: 34 since Dec 2015
Thanks Given: 1
Thanks Received: 5

Hello, currently, TOS script is not given the ability to interact with mouse over or drawing items. It will not do what you are asking. Yet you can script a second label to appear or change colors when certain criteria occur, such as slope change of x% or from n bars past. Perhaps that idea will help.


Reply With Quote
  #3 (permalink)
madeinnyc
Highland Park, TX
 
Posts: 36 since Jan 2020
Thanks Given: 17
Thanks Received: 20



VanDriver View Post
Hello, currently, TOS script is not given the ability to interact with mouse over or drawing items. It will not do what you are asking. Yet you can script a second label to appear or change colors when certain criteria occur, such as slope change of x% or from n bars past. Perhaps that idea will help.

@VanDriver, I appreciate the idea, Thank you!


Reply With Quote




Last Updated on July 19, 2020


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts