Hi all -very new here with limited to no coding experience but keen to learn. I have gone through some of the C# tutorials on the Microsoft site but may be trying to move too fast here. I have just read Andreas Clenow's book "Stocks on the Move" (great book) and I want to be able to code a backtest where by I buy members of the S&P500 based on their adjusted slope values. Basically, I want to:

1. Determine the 90 day annualized exponential regression slope for each stock

2. Determine the 90 day R-squared value for each of the stock

3. Multiply #1 * #2 and then sort from highest to lowest

4. Buy the top stocks based on the formula ((AccountValue * 0.001)/ATR(20))

There is some other logic that helps to determine when to buy and when to sell (like buy only if the S&P500 is above its 200 day SMA) I am not even sure where to start; but am not asking for someone to do it for me. Is there any suggestions on where to start with a coding challenge like this? Is there a better way to go about building this algorithm?