Skip to content
All library documents

Using Vector Dot Products to Approximate Direction Between Price Bars

Article Quant Q&A · Author: montyhall

Summary

The document addresses how to represent directional change between adjacent market bars when discrete price observations do not provide a directly meaningful geometric angle. It clarifies that angles are defined between vectors, rather than isolated points, and suggests using the vectors’ dot product as a proxy related to the cosine of their angle.

The original question proposes Euclidean distance between adjacent time-price points, with time spacing set to one, but the response redirects the calculation toward vector direction. This is a general geometry observation rather than a quantitative trading method, and the response explicitly notes that it has no particular connection to quantitative finance. The excerpt does not specify how to construct the vectors from market data, normalize the dot product, or interpret changes in price scale, so the proxy needs additional definition before use in a trading input.

Key ideas

  • An angle is defined between vectors, not between two points.
  • The dot product of two vectors provides a quantity related to the cosine of their angle.
  • Euclidean distance between adjacent time-price points measures separation rather than direction.
  • The proposed geometric proxy is not developed into a complete trading indicator.

Tags

Full text
# Proxy for a trigonometric angle function


# Proxy for a trigonometric angle function












You can't calculate an actual/real angle with the sine function with discrete market data.

I need a substitute value for inputs that require an angle value.

If you're only calculating the angle between two adjacent bars, is it possible to use the distance formula as a proxy (x=1)?

Distance between two points:

c = SquareRoot((Xa-Xb)^2 + (Ya-Yb)^2);

c =distance

X=interval (time) = 1

Y=price

Distance between two points

http://www.mathsisfun.com/algebra/distance-2-points.html

## Answer by LazyCat (score 2)

https://quant.stackexchange.com/a/4561

You don't compute angle between points, but between vectors. If you want a proxy for a cos of the angle between vectors (x1, y1), (x2, y2), take their dot product x1 * x2 + y1 * y2. This has nothing to do with quantitative finance.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.