I'm new to QuantConnect, and I want to get some practice using C# and programming/coding basic strategies. How would I do something like Joseph Greenblatt's Magic Formula?

From what I understand, I would need to run through all the securities in an exchange, add them to a data structure should they meet a certain market cap / trading volume requirement, then rank them separately in another data structure based on their P/E ratio and their ROI. Then, I would have the algorithm purchase the top 10 ranked securities in the data structure. Is that correct? This sounds very inefficient.

I'm very new to C# and QuantConnect and would appreciate any advice and tips.