Function to Get the slope of anything

Questions about MultiCharts and user contributed studies.
Kingjelly
Posts: 25
Joined: 23 Jan 2008

Function to Get the slope of anything

Postby Kingjelly » 23 Mar 2011

Hi,

Has anyone by chance written a function that can be called to get the slope of a moving average, or indicator or anything you want pass to it?

Thanks,

Preston

User avatar
TJ
Posts: 6550
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 965 times
Been thanked: 1892 times

Re: Function to Get the slope of anything

Postby TJ » 23 Mar 2011

Kingjelly wrote:Hi,

Has anyone by chance written a function that can be called to get the slope of a moving average, or indicator or anything you want pass to it?

Thanks,

Preston


Can you define your meaning of "Slope"?

Kingjelly
Posts: 25
Joined: 23 Jan 2008

Re: Function to Get the slope of anything

Postby Kingjelly » 23 Mar 2011

TJ,

rise over run


Rules for Calculating the Slope of a Line

# Find two points on the line.

# Count the rise (How many units do you count up or down to get from one point to the next?) Record this number as your numerator.

# Count the run (How many units do you count left or right to get to the point?) Record this number as your denominator.

# Simplify your fraction if possible.

IMPORTANT NOTE:

# If you count up or right your number is positive.

# If you count down or left your number is negativ

User avatar
TJ
Posts: 6550
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 965 times
Been thanked: 1892 times

Re: Function to Get the slope of anything

Postby TJ » 24 Mar 2011

Kingjelly wrote:TJ,

rise over run

Rules for Calculating the Slope of a Line

# Find two points on the line.

# Count the rise (How many units do you count up or down to get from one point to the next?) Record this number as your numerator.

# Count the run (How many units do you count left or right to get to the point?) Record this number as your denominator.

# Simplify your fraction if possible.

IMPORTANT NOTE:

# If you count up or right your number is positive.

# If you count down or left your number is negativ


if that is your definition, then consider this for a moving average:

Code: Select all

slope = MA - MA[1]

or

Code: Select all

slope = (MA[start.point] - MA[end.point]) / (end.point - start.point)

User avatar
TJ
Posts: 6550
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 965 times
Been thanked: 1892 times

Re: Function to Get the slope of anything

Postby TJ » 27 Mar 2011

you can get more slope information here:

http://tradersxchange.com/viewtopic.php ... a69337c58a

Image

User avatar
Stan Bokov
Posts: 963
Joined: 18 Dec 2009
Has thanked: 367 times
Been thanked: 300 times

Re: Function to Get the slope of anything

Postby Stan Bokov » 12 Apr 2011

Thanks, TJ.


Return to “MultiCharts”