Hi, 

I hear trading gurus always talk about how support levels are super important and how different assets have different support moving averages. So TSLA might find support at the 21-day exponential moving average while AAPL might do so at the 50-SMA. 

It's fairly easy to look at a graph and find the moving averages yourself. However, I would like to write something that is not subjective. Any ideas on how you could implement finding the best support moving average for an asset? 

I was thinking of somehow measuring the absolute distance between the current price and the moving average: | Price(x) - MA(x) |. Then do that for all data points and all moving averages and see which MA's on average get closes to the price. However, this falls short with slower-moving averages. Say, the 200-SMA is a very strong support level but the price almost never falls down to that level. However, if it did it would indeed work as a strong support level. 

Any ideas are very appreciated. Thanks :-) 

Stinus