How can i code if current price is above the 20 day MA
then check to see if
12 SMA is greater than 26 SMA
How can i code if current price is above the 20 day MA
then check to see if
12 SMA is greater than 26 SMA
You can use the pipeline API to calculate the 20, 12 and 26 day moving averages. These would be computed for all securities every day before trading starts.
You would have to narrow your universe down to the 500 securities that you are most interested in. Perhaps a screen based on the difference between the 12 and 26 day moving average? Either including all stocks where the 12 day is greater (or less than) the 26 day, depending on your theory.
From there you can pass the pipeline output into your algorithm with the 12, 20 and 26 day moving averages to do your comparisons.
Attached is an example that might help you explore the pipeline API
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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.
Lakith,
Here is an example showing how I would using the pipeline API to do the price comparisons you were asking about.
Hope this is helpful,
KR
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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.
Thanks Karen.... Do people use the quantopian for day trading basis... also whats pipe line.... and i'm having very hard time with indent errors..
any advice
Hi Lakith,
Yes, some members of our community use the Quantopian platform for day trading, check out some of these community posts:
https://www.quantopian.com/posts/does-quantopian-support-day-trading
https://www.quantopian.com/posts/how-to-determine-if-a-day-is-the-last-trading-day-of-the-month
Check out this post for a good description of the Pipeline API: https://www.quantopian.com/posts/introducing-the-pipeline-api
Regarding the indent errors, make sure that you are following Python's indentation rules and if you are having a hard time figuring out the problem, you can email us at [email protected] and we can help you figure it out!
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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.