Function to Get the slope of anything
Posted: Mar 23 2011
by Kingjelly
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
Re: Function to Get the slope of anything
Posted: Mar 23 2011
by TJ
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"?
Re: Function to Get the slope of anything
Posted: Mar 23 2011
by Kingjelly
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
Re: Function to Get the slope of anything
Posted: Mar 24 2011
by TJ
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:
or
Code: Select all
slope = (MA[start.point] - MA[end.point]) / (end.point - start.point)
Re: Function to Get the slope of anything
Posted: Mar 27 2011
by TJ