Back to Community
My First Algo

Hello all, this is my first algo.
Traded items is gold futures.
My strategy is as follows:
Follow the weekly close price of gold futures. Check the last 3 weekly close price. If there is a peak, short it. It there is a trough, buy it. The stop gain is set to take profit at 50 (or 30 - 80). The stop loss is set if the trend goes opposite and hit the before peak / trough.
The backtest result went from 2015-01-01 to current. Approximate return is 34% (without leverage) and ahpha is 0.11, beta is 0 and sharpe is 0.95 and sortino is 1.41.
1) May you help to comment if the alpha, beta, sharpe is good or bad as I have little knowledge in finance.
2) There are 2 consecutive buy / sell within minutes in the transaction details. According to my algorithm, this should not happen. I don't know why.
3) Feel free to add comments or improvements for the algorithm. Yeah!

Thanks a lot.

Clone Algorithm
15
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 59bf86b0c1980c54e561209a
There was a runtime error.
2 responses

Hi Nick,

You are off to a great start! A good way of analyzing your strategy's performance is to generate a pyfolio tearsheet. Currently, pyfolio's support for futures is limited, but the returns tearsheet (shared below) will give you some insight on rolling sharpe and beta.

In general, you want to aim for a sharpe ratio above 1, which means your increase in portfolio returns is greater than the risk taken to generate those returns. Your algorithm's annualized sharpe ratio is slightly below 1, but the returns tearsheet show that on average your algorithm had a sharpe ratio above 1 and towards the end of the backtest period it had a positive trend.

For beta-to-market you want a value as close to 0 as possible, which means your portfolio returns have a low correlation to the market. Your algorithm's metrics include an annualized beta close to 0, however, the rolling beta shown in the tearsheet shows a period where beta spikes close to +/- 0.5. It would be a good exercise to investigate what caused these spikes.

The consecutive transactions you see in the backtest details happen because of liquidity issues. If an order does not completely fill on a given minute bar due to insufficient volume it carries over to subsequent bars until it gets filled or until market close, at which point it gets canceled. For more details, I would recommend you checking out the Volume, Slippage and Liquidity lesson from our Lecture Series and also the Slippage and Commission lesson from the Getting Started tutorial.

If you are interested in receiving an allocation from Quantopian, I would recommend you following our allocation criteria guidelines for futures as you develop and improve your strategies.

I hope this helps.

Loading notebook preview...
Notebook previews are currently unavailable.
Disclaimer

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. Your reply helps and points a direction for further improvement.