LEAN is the open source
algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a
global community of 80+ engineers and powers more than a dozen hedge funds today.
Alpha League Competition: $1,000 Weekly Prize Pool
Qualifying Alpha Streams Reentered Weekly Learn
more
I want to build an algorithm to scan pre-market stocks trading in the NASDAQ for big volume and large volatility.
Is there any similar algorithm or algorithms in c#, c++ that I can use as a reference?
Also, I would place the stop loss 10 percent below the trading price.
Can anyone please provide some code snippets or an algorithm for these particular issues?
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.
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.
Travis Teichelmann
5.6k
,
I'm working on something similar and there is definitely a way to do it on this platform. What you're looking for is called the coarse universe function. I believe that QC has a database of over 9000 securities so it scans through all of those.
Here is a snippet for the coarse universe selection:
https://kobra.io/#/e/-KBBPeqpbdI8g0SS4tIo
The return function will take the stocks that meet the filter requirements and put them into the IEnumerable collection.
Since volatility can be determined in a number of ways you'll have to be a little more specific on what criteria you would like to use.
There are over 40 algorithms within the university that are great to look at if you need a better grasp of c#. The community also has a search function so you can find just about anything that you're looking for if you're clever with your words. I'm about to leave work so I'll finish my response when I get home. Hope this helped in some way.
0
Jared Broad
,
@Olivera, there isn't a way to scan based on pre-market data (using QuantConnect data) at this time. Coarse Universe Selection allows scanning but uses normal market hours prices and volumes.
If you have your own premarket activity data you can import this as as custom universe data source. This isn't well documented yet but you can see some examples here: https://github.com/QuantConnect/Lean/blob/master/Algorithm.CSharp/CustomDataUniverseAlgorithm.cs
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.
Simon Bray
29
,
Is there anything similar to this in Python? Market-hours is fine. thx
0
Alexandre Catarino
,
In Python, we can use Coarse Universe Selection that allows scanning but uses normal market hours prices and volumes:
# In Initialize:
self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction)
These functions receive the Coarse and Fine universes, where returns a list of symbols that obey our filtering criteria. E.g.::
def CoarseSelectionFunction(self, coarse):
# sort descending by daily dollar volume
sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
# return the symbol objects of the top entries from our sorted collection
top5 = sortedByDollarVolume[:self.__numberOfSymbols]
# we need to return only the symbol objects
list = List[Symbol]()
for x in top5:
list.Add(x.Symbol)
return list
Please checkout the working example below. For other examples, take a look at the open-source project.
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.
Karen Chaltikian
1.7k
,
How can this example of volume-based selection be modified to use volume averaged over some period? Otherwise the universe changes quite a bit. The built-in universe python object has no history associated with it, so it seems x.DollarVolume above is just the last day's volume
0
Alexandre Catarino
,
We can start from the EmaCrossUniverseSelectionAlgorithm and instead of using two moving averages of price, we would use only one moving average of dollar volume.
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.
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...
To unlock posting to the community forums please complete at least 30% of Boot Camp. You can
continue your Boot Camp training progress from the
terminal. We hope to see you in the community soon!
You do not have enough QC Credit to send this award, get a QC Credit Pack
here.
Award Sent Successfully
Thank you for giving back to the community.
Processing...
Choose a Credit Pack
Payment Confirmation
QuantConnect Credit (QCC) can be applied to your cloud-invoices or
gifted to others in the community with Community Awards in recognition of their contributions.
Community Awards highlight the awesome work your fellow community members are doing and inspires
high quality algorithm contributions to the community. Select an option below to add
QuantConnect Credit to your account:
$5
500 Credit Points
 
$10
1,000 Credit Points
 
$18
2,000 Credit Points
10% bonus
$45
5,000 Credit Points
10% bonus
03/23XXXX XXXX XXXX 0592
We will charge your default organization credit card on file, click
here to update.