Tangent to a Moving Average and its Gradient

To add comments, please log in or register
Nelson Wanyama
388
Nelson Wanyama  
Hello programmers! Can anyone please help me figure out a way of calculating the tangent of a moving average then find its gradient Please?
Chris70
649
Chris70  

Simple answer: you can't.

Reason: just by zooming in/out separately on your x-axis (time) or y-axis (price) you get a completely different slope / angle / steepness (e.g. if you just move the mouse over the axis with pressed down left mouse button).

What you can do instead for the slope of the most recent segment of the MA: evaluate the change per time, which is (MA[0]-MA[1])/PeriodSeconds(PERIOD_CURRENT)

Nelson Wanyama
388
Nelson Wanyama  
Chris70:

Simple answer: you can't.

Reason: just by zooming in/out separately on your x-axis (time) or y-axis (price) you get a completely different slope / angle / steepness (e.g. if you just move the mouse over the axis with pressed down left mouse button).

What you can do instead for the slope of the most recent segment of the MA: evaluate the change per time, which is (MA[0]-MA[1])/PeriodSeconds(PERIOD_CURRENT)

Thank you
To add comments, please log in or register