I am trying to develop some algorithm in stock market, I want to compare two different sets of prices, please see below image to understand clearly,


If you see above image I have plotted two different sets of prices purple and black, Purple line is set of prices of example $2000, 2003, 2001, 2005$ .. etc, the black line is set of prices of example $12, 12.3, 12.1, 12.5$ etc ...

prices like 2000 are future price and $12, 12.3$ etc is option price, Option price move same like future price. Now If you see chart irrespective of difference between two numbers, prices are plotted in chart in same direction with few difference, see bigger image below

enter image description here

Now my question is how do I find if the purple line is above the black line or below the black line via maths? I can see it visually in chart, but how do I convert those into numbers. I am completely new to this math forum, so please ask any doubt in comments.

P.s : Real time usage of this algorithm is to find overbrought or oversold options and buy/sell option respectively.

  • $\begingroup$ Why not just calculate the difference (future - option) and see whether it's positive or negative. Of calculate the ratio (future/option) and see whether it's greater or less than 1. Either of these is easy in a spreadsheet.If you don't have numbers, just the picture, you will have to estimate the numbers using the horizontal rulings, or find some software to do that automatically from the image. That's not a math question. $\endgroup$ – Ethan Bolker Feb 13 at 14:48
  • $\begingroup$ The problem is that you are plotting two curves with different scales onto the same plot. In the example data you provide, the future price is always going to be above the option price because 2000 >> 12! The fact that it sometime appears up "below" in your plot is because the axes are rescaled to fit in the same picture! $\endgroup$ – Riccardo Sven Risuleo Feb 13 at 14:50
  • $\begingroup$ Hi , Difference between future and option will always be positive , because future price will be in 1000's and options will be in 10's $\endgroup$ – Gracie williams Feb 13 at 14:51
  • $\begingroup$ @RiccardoSvenRisuleo Sven Risuleo : Yes exactly , but there gotta be some means why its up , maybe %increase in future is more than %increase of option , I understand why its up and down , I need to find which one is up , because thats useful for my algorithm to find overbrought , oversold options. $\endgroup$ – Gracie williams Feb 13 at 14:52
  • $\begingroup$ If you are talking about growth then % increase is a good measure: just to (newprice - oldprice) / (oldprice). However this will not tell you which curve is up, but which curve is growing the fastest! You might want to consider a wider window, maybe averaging the old price over some samples to remove noise) $\endgroup$ – Riccardo Sven Risuleo Feb 13 at 14:57

This is just a formalization of the answers in the comments.
The best way to plot two graphs with different scales on the same scale is normalize them and then plot them. This converts them both to the same scale making such comparisons trivial...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.