I am developing a script that I'd like to do the following:

Script Idea:

Towards the end of the trading day, i would like to query all S&P stocks that:
a. dropped in price by at least 10%
b. have a price greater than 1.00
c. have a sales 1-year change of greater than 50%

from this query, we will choose 5 stocks.

throughout the next day, those 5 stocks will be sold once they hit a certain price target or liquidated at the end of the day.

At the end of the next day, the same process repeats itself.

The Problem:

I am constantly running into resource issues.

Per my support request, this was the tech's suggestion:

The issue with your code is that Coarse Fundamental is not filtering enough. Fine Fundamental receives about 5200 symbols and that is a lot of data to be read. I would advice you to found a condition to order the securities at coarse fundamental and only select the first 1000, 500, 200, etc members (for example, dollar volume). 

By the way, you have a Schedule Event for every minute that you don't need to, since you can move that logic to OnData (that is triggered every minute).


I'm hoping I can find someone in the community to help me finish up the script. My developer skills are extremely rusty, so I'd rather pay someone familiar with the system to give a hand. Any takers?