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
Function to Get the slope of anything [SOLVED]
- TJ
- Posts: 7774
- Joined: Aug 29 2006
- Location: Global Citizen
- Has thanked: 1036 times
- Been thanked: 2233 times
Can you define your meaning of "Slope"?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
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
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
- TJ
- Posts: 7774
- Joined: Aug 29 2006
- Location: Global Citizen
- Has thanked: 1036 times
- Been thanked: 2233 times
if that is your definition, then consider this for a moving average: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
Code: Select all
slope = MA - MA[1]
Code: Select all
slope = (MA[start.point] - MA[end.point]) / (end.point - start.point)
- TJ
- Posts: 7774
- Joined: Aug 29 2006
- Location: Global Citizen
- Has thanked: 1036 times
- Been thanked: 2233 times
- Stan Bokov
- Posts: 963
- Joined: Dec 18 2009
- Has thanked: 367 times
- Been thanked: 302 times
Thanks, TJ.