Back

Pre-market gap scan

Hi Guys

I'm new to QC. I would like to automate some of my daytrading setups. I have briefly read all the documentation, but did not see any clear discussions on picking a symbol set before the open. 

For example if I want create an algo that would do the following:

1. at 9:20AM pre-market, find symbols (equity) that are over $1 and under $10, where the last price at 9:20AM is > 20% from previous days closing price.

2.  volume at 9:20AM must be > 200k

3. Get the highest high between yesterday's close and 9:20AM (pre-market high)

4. After the market opens go long on break of PM high.

How would i go about doing that.

Is there a sample algo already written that does something similar to this?

Thanks for any help.

Update Backtest








Since your algorithm creates an universe of symbols that fall under some criteria, you should start developing a Universe Selection algorithm. In the Coarse Universe, we have price and volume information, the ingredients for your selection. However, since you need the previous close, please save it in a dictionary:

private Dictionary<Symbol, decimal> _prevClose;

// In Initialize
AddUniverse(coarse => {
var symbols = (from c in coarse
where _prevClose.ContainsKey(c.Symbol)
where c.Price > _prevClose[c.Symbol] * 1.2
where c.Price > 1
where c.Price < 10
where c.DollarVolume > 200000
orderby c.DollarVolume descending
select c.Symbol).Take(50);

foreach (var c in coarse)
{
if (_prevClose.ContainsKey(c.Symbol)
{
_prevClose[c.Symbol] = c.Price;
}
else
{
_prevClose.Add(c.Symbol, c.Price);
}
}

return symbols;
});

After this pre-selection is done, you need to make a History Request to fetch the High for each symbols and continue with your trading logic.

1

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


thanks Alexandre, will try it out

0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed