- Profile
- Backtests
- Community

Quantitative Developer at QuantConnect. Studied Computer Science and Finance at the University of Lethbridge. Competitor in the 2020-1 Rotman International Trading Competitions.
See my latest posts at derekmelchin.com.

We are pioneering the radical future for open-source quant finance. QuantConnect is the world's largest quant community, empowering 220,000 quants with a framework, data, and infrastructure for their investments.

0Net Profit

0PSR

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

0Parameters

0Security Types

0Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

327.238Net Profit

10.176PSR

0.592Sharpe Ratio

0.122Alpha

1.23Beta

24.252CAR

64.5Drawdown

42Loss Rate

0Parameters

2Security Types

0.715Sortino Ratio

1682Tradeable Dates

9386Trades

0.176Treynor Ratio

58Win Rate

115.888Net Profit

38.93PSR

0.773Sharpe Ratio

0.067Alpha

0.444Beta

17.945CAR

22.5Drawdown

45Loss Rate

0Parameters

2Security Types

0.852Sortino Ratio

1702Tradeable Dates

6597Trades

0.24Treynor Ratio

55Win Rate

133.599Net Profit

50.563PSR

0.89Sharpe Ratio

0.08Alpha

0.434Beta

19.956CAR

20Drawdown

45Loss Rate

0Parameters

2Security Types

1.012Sortino Ratio

1702Tradeable Dates

6673Trades

0.274Treynor Ratio

55Win Rate

20.619Net Profit

0.882PSR

-0.072Sharpe Ratio

-0.024Alpha

0.216Beta

2.478CAR

8.9Drawdown

45Loss Rate

0Parameters

1Security Types

-0.075Sortino Ratio

0Tradeable Dates

473Trades

-0.022Treynor Ratio

55Win Rate

Derek submitted the research Copying Congress Trades

This research explores a trading algorithm that mimics trades made by U.S. Congress members, leveraging their privileged access to market-moving information. The Stop Trading on Congressional Knowledge (STOCK) Act mandates disclosure of such trades, enabling public access. Using the Quiver Quantitative dataset, the algorithm employs an inverse-volatility weighting scheme to balance risk across assets, limiting individual asset exposure to 10% to mitigate concentration risk. By forming a portfolio based on these disclosures, the strategy aims to capitalize on the informational advantage indirectly.

Derek submitted the research Probabilistic Sharpe Ratio

The Probabilistic Sharpe Ratio (PSR) is a method for evaluating investment performance that takes into account the non-normality of returns. The traditional Sharpe ratio assumes that returns are normally distributed, which can lead to misleading results for strategies with non-normal returns. The PSR addresses this limitation by considering the distribution of returns and estimating the probability that a given Sharpe ratio is a result of skill rather than luck. This provides a more accurate measure of a strategy's performance and allows for better comparisons between different strategies. The PSR is particularly useful for strategies with non-normal returns, as it takes into account the impact of skewness and kurtosis on the statistical significance of the observed Sharpe ratio.

Derek left a comment in the discussion Futures Fast Trend Following, with Trend Strength

Hi Eko1900, we cloned the algorithm above and backtested it but we were unable to reproduce this...

Derek left a comment in the discussion Gaussian Naive Bayes Model

Hi Lou, please run the PEP8 version of the algorithm above. It fixes this error.

0Net Profit

0PSR

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

0Parameters

0Security Types

0Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

327.238Net Profit

10.176PSR

0.592Sharpe Ratio

0.122Alpha

1.23Beta

24.252CAR

64.5Drawdown

42Loss Rate

0Parameters

2Security Types

0.715Sortino Ratio

1682Tradeable Dates

9386Trades

0.176Treynor Ratio

58Win Rate

115.888Net Profit

38.93PSR

0.773Sharpe Ratio

0.067Alpha

0.444Beta

17.945CAR

22.5Drawdown

45Loss Rate

0Parameters

2Security Types

0.852Sortino Ratio

1702Tradeable Dates

6597Trades

0.24Treynor Ratio

55Win Rate

133.599Net Profit

50.563PSR

0.89Sharpe Ratio

0.08Alpha

0.434Beta

19.956CAR

20Drawdown

45Loss Rate

0Parameters

2Security Types

1.012Sortino Ratio

1702Tradeable Dates

6673Trades

0.274Treynor Ratio

55Win Rate

20.619Net Profit

0.882PSR

-0.072Sharpe Ratio

-0.024Alpha

0.216Beta

2.478CAR

8.9Drawdown

45Loss Rate

0Parameters

1Security Types

-0.075Sortino Ratio

0Tradeable Dates

473Trades

-0.022Treynor Ratio

55Win Rate

98.915Net Profit

24.9PSR

0.622Sharpe Ratio

0.03Alpha

0.738Beta

15.962CAR

25.5Drawdown

51Loss Rate

0Parameters

2Security Types

0.684Sortino Ratio

1695Tradeable Dates

523Trades

0.131Treynor Ratio

49Win Rate

150.697Net Profit

52.879PSR

0.934Sharpe Ratio

0.092Alpha

0.458Beta

21.903CAR

18.7Drawdown

40Loss Rate

0Parameters

1Security Types

1.058Sortino Ratio

0Tradeable Dates

1960Trades

0.292Treynor Ratio

60Win Rate

8.061Net Profit

0.364PSR

-0.536Sharpe Ratio

-0.025Alpha

0.106Beta

0.901CAR

8Drawdown

53Loss Rate

0Parameters

2Security Types

-0.289Sortino Ratio

2172Tradeable Dates

462Trades

-0.148Treynor Ratio

47Win Rate

-17.194Net Profit

2.003PSR

-0.606Sharpe Ratio

-0.263Alpha

1.085Beta

-10.878CAR

31.5Drawdown

60Loss Rate

0Parameters

1Security Types

-0.701Sortino Ratio

0Tradeable Dates

4561Trades

-0.104Treynor Ratio

40Win Rate

151.424Net Profit

53.188PSR

0.937Sharpe Ratio

0.093Alpha

0.458Beta

21.979CAR

18.7Drawdown

40Loss Rate

0Parameters

1Security Types

1.062Sortino Ratio

0Tradeable Dates

1960Trades

0.293Treynor Ratio

60Win Rate

45.986Net Profit

75.187PSR

1.107Sharpe Ratio

-0.009Alpha

0.988Beta

26.028CAR

10.8Drawdown

20Loss Rate

0Parameters

1Security Types

1.57Sortino Ratio

0Tradeable Dates

1023Trades

0.13Treynor Ratio

80Win Rate

56.65Net Profit

5.718PSR

0.381Sharpe Ratio

0.051Alpha

1.534Beta

10.162CAR

64.8Drawdown

41Loss Rate

0Parameters

1Security Types

0.37Sortino Ratio

0Tradeable Dates

1996Trades

0.124Treynor Ratio

59Win Rate

20.57Net Profit

97.494PSR

3.343Sharpe Ratio

0.078Alpha

0.208Beta

20.529CAR

3.4Drawdown

0Loss Rate

0Parameters

0Security Types

253Tradeable Dates

21Trades

0.642Treynor Ratio

1.44Win Rate

65.602Net Profit

87.68PSR

1.083Sharpe Ratio

0.033Alpha

0.285Beta

12.72CAR

7.5Drawdown

9Loss Rate

0Parameters

2Security Types

0.849Sortino Ratio

1061Tradeable Dates

89Trades

0.216Treynor Ratio

91Win Rate

7.927Net Profit

57.516PSR

2.205Sharpe Ratio

0.469Alpha

1.227Beta

147.915CAR

11.1Drawdown

-0.48Loss Rate

0Parameters

0Security Types

23Tradeable Dates

2Trades

0.604Treynor Ratio

0Win Rate

52.883Net Profit

87.077PSR

0.977Sharpe Ratio

0.023Alpha

0.24Beta

10.602CAR

6.4Drawdown

9Loss Rate

0Parameters

2Security Types

0.765Sortino Ratio

1061Tradeable Dates

89Trades

0.195Treynor Ratio

91Win Rate

52.883Net Profit

87.077PSR

0.977Sharpe Ratio

0.023Alpha

0.24Beta

10.602CAR

6.4Drawdown

9Loss Rate

0Parameters

2Security Types

0.765Sortino Ratio

1061Tradeable Dates

89Trades

0.195Treynor Ratio

91Win Rate

52.883Net Profit

87.077PSR

0.977Sharpe Ratio

0.023Alpha

0.24Beta

10.602CAR

6.4Drawdown

9Loss Rate

0Parameters

2Security Types

0.765Sortino Ratio

1061Tradeable Dates

89Trades

0.195Treynor Ratio

91Win Rate

40.927Net Profit

69.345PSR

0.974Sharpe Ratio

-0.011Alpha

0.986Beta

23.602CAR

10.9Drawdown

19Loss Rate

0Parameters

1Security Types

1.369Sortino Ratio

0Tradeable Dates

1010Trades

0.114Treynor Ratio

81Win Rate

92.319Net Profit

22.549PSR

0.59Sharpe Ratio

0.028Alpha

0.738Beta

15.2CAR

25.5Drawdown

51Loss Rate

0Parameters

2Security Types

0.648Sortino Ratio

1687Tradeable Dates

523Trades

0.124Treynor Ratio

49Win Rate

92.319Net Profit

22.549PSR

0.59Sharpe Ratio

0.028Alpha

0.738Beta

15.2CAR

25.5Drawdown

51Loss Rate

0Parameters

2Security Types

0.648Sortino Ratio

1687Tradeable Dates

523Trades

0.124Treynor Ratio

49Win Rate

64.422Net Profit

34.537PSR

0.696Sharpe Ratio

0.193Alpha

0.328Beta

32.098CAR

37.3Drawdown

22Loss Rate

0Parameters

2Security Types

0.845Sortino Ratio

652Tradeable Dates

17Trades

0.699Treynor Ratio

78Win Rate

8.02Net Profit

0.364PSR

-0.533Sharpe Ratio

-0.025Alpha

0.106Beta

0.899CAR

8Drawdown

53Loss Rate

0Parameters

2Security Types

-0.287Sortino Ratio

2167Tradeable Dates

466Trades

-0.147Treynor Ratio

47Win Rate

182.391Net Profit

73.288PSR

4.085Sharpe Ratio

4.219Alpha

0.187Beta

435.569CAR

65.6Drawdown

0Loss Rate

0Parameters

2Security Types

5.633Sortino Ratio

193Tradeable Dates

2Trades

22.707Treynor Ratio

0Win Rate

96.207Net Profit

49.03PSR

0.989Sharpe Ratio

0.28Alpha

0.293Beta

45.836CAR

28.3Drawdown

12Loss Rate

0Parameters

2Security Types

1.243Sortino Ratio

652Tradeable Dates

15Trades

1.064Treynor Ratio

88Win Rate

96.207Net Profit

49.03PSR

0.989Sharpe Ratio

0.28Alpha

0.293Beta

45.836CAR

28.3Drawdown

12Loss Rate

0Parameters

2Security Types

1.243Sortino Ratio

652Tradeable Dates

15Trades

1.064Treynor Ratio

88Win Rate

93.129Net Profit

7.978PSR

0.466Sharpe Ratio

0.106Alpha

1.624Beta

15.316CAR

65.5Drawdown

41Loss Rate

0Parameters

1Security Types

0.465Sortino Ratio

0Tradeable Dates

1968Trades

0.148Treynor Ratio

59Win Rate

8.02Net Profit

0.364PSR

-0.533Sharpe Ratio

-0.024Alpha

0.106Beta

0.899CAR

8Drawdown

53Loss Rate

0Parameters

2Security Types

-0.287Sortino Ratio

2166Tradeable Dates

466Trades

-0.147Treynor Ratio

47Win Rate

3.53Net Profit

0.073PSR

-0.712Sharpe Ratio

-0.015Alpha

-0.045Beta

0.403CAR

7.4Drawdown

46Loss Rate

0Parameters

2Security Types

-0.451Sortino Ratio

2166Tradeable Dates

111Trades

0.427Treynor Ratio

54Win Rate

6.102Net Profit

0.159PSR

-0.542Sharpe Ratio

-0.014Alpha

-0.04Beta

0.689CAR

11.3Drawdown

43Loss Rate

0Parameters

2Security Types

-0.521Sortino Ratio

2166Tradeable Dates

269Trades

0.421Treynor Ratio

57Win Rate

Derek submitted the research Copying Congress Trades

This research explores a trading algorithm that mimics trades made by U.S. Congress members, leveraging their privileged access to market-moving information. The Stop Trading on Congressional Knowledge (STOCK) Act mandates disclosure of such trades, enabling public access. Using the Quiver Quantitative dataset, the algorithm employs an inverse-volatility weighting scheme to balance risk across assets, limiting individual asset exposure to 10% to mitigate concentration risk. By forming a portfolio based on these disclosures, the strategy aims to capitalize on the informational advantage indirectly.

Derek submitted the research Probabilistic Sharpe Ratio

The Probabilistic Sharpe Ratio (PSR) is a method for evaluating investment performance that takes into account the non-normality of returns. The traditional Sharpe ratio assumes that returns are normally distributed, which can lead to misleading results for strategies with non-normal returns. The PSR addresses this limitation by considering the distribution of returns and estimating the probability that a given Sharpe ratio is a result of skill rather than luck. This provides a more accurate measure of a strategy's performance and allows for better comparisons between different strategies. The PSR is particularly useful for strategies with non-normal returns, as it takes into account the impact of skewness and kurtosis on the statistical significance of the observed Sharpe ratio.

Derek left a comment in the discussion Can Crude Oil Predict Equity Returns

Hi Chris, the Nasdaq Data Link datasets that this research uses have been discontinued.

Derek left a comment in the discussion Futures Fast Trend Following, with Trend Strength

Hi Eko1900, we cloned the algorithm above and backtested it but we were unable to reproduce this...

Derek left a comment in the discussion Gaussian Naive Bayes Model

Hi Lou, please run the PEP8 version of the algorithm above. It fixes this error.

Derek left a comment in the discussion Commodities Futures Trend Following

See the attached backtest for an updated version of the algorithm with the following changes:

Derek left a comment in the discussion G Score Investing

See the attached backtest for an updated version of the algorithm with the following changes:

Derek left a comment in the discussion Optimal Pairs Trading

See the attached backtest for an updated version of the algorithm in PEP8 style.

Derek submitted the research Combined Carry and Trend

This research is a re-creation of strategy #11 from Advanced Futures Trading Strategies (Carver, 2023) that combines carry and trend strategies in futures trading. The algorithm incorporates exponential moving average crossover (EMAC) trend forecasts and carry forecasts to form a diversified portfolio. The results show that using both styles of strategies can improve risk-adjusted returns. Additionally, the research provides a background on how carry returns are calculated for different asset classes and how the strategy calculates and smooths carry from different future contracts.

Derek submitted the research Sector Rotation Based On News Sentiment

Abstract: This tutorial explores a sector rotation strategy based on news sentiment using the LEAN algorithmic trading engine and datasets from the QuantConnect Dataset Market. The strategy involves monitoring the news sentiment for 25 different sector Exchange Traded Funds (ETFs) and periodically rebalancing the portfolio to maximize exposure to sectors with the highest public sentiment. Backtesting results demonstrate that the strategy consistently outperforms benchmark approaches. The tutorial provides details on universe selection, implementation, and presents equity curves and Sharpe ratios for different versions of the strategy and benchmarks. To replicate the results, users are encouraged to clone and backtest each algorithm.

Derek submitted the research Detecting Impactful News In ETF Constituents

Abstract: This tutorial focuses on utilizing natural language processing (NLP) to detect impactful news in ETF constituents. Building upon a previous NLP strategy, we monitor the Tiingo News Feed to determine intraday news sentiment of the largest constituents in the Nasdaq-100 index, while avoiding look-ahead bias. The results indicate that this strategy has experienced lower risk-adjusted returns compared to the QQQ ETF over the past two years. The tutorial discusses the implementation of this strategy as a framework algorithm using the LEAN trading engine, including universe selection and portfolio construction. Backtesting results show a Sharpe ratio of -0.659, with comparisons to other benchmarks provided.

Derek submitted the research Head & Shoulders TA Pattern Detection

This discussion focuses on the detection of the head and shoulders pattern in technical analysis. While technical analysis traders commonly use graphical patterns to identify trading opportunities, quant traders tend to overlook them due to subjectivity and difficulty in accurate detection. However, this tutorial presents a method to programmatically detect the head and shoulders pattern in an event-driven trading algorithm. The algorithm achieves greater risk-adjusted returns than the benchmarks during the backtesting period. The head and shoulders pattern consists of two shoulders, a tall head, and a neckline. It is believed to signal a bullish-to-bearish trend reversal. Further research can include testing other technical patterns, adjusting algorithm parameters, exploring new position sizing techniques, implementing different exit strategies, and incorporating risk management for corporate actions.

Derek submitted the research Futures Fast Trend Following, with Trend Strength

This research focuses on Futures Fast Trend Following strategies that can be applied to both long and short positions, taking into account the strength of the trend. The purpose of the research is to explore the effectiveness of these strategies and their potential implications for trading in the futures market. The research utilizes various methods to analyze historical data and identify trends, and the key findings highlight the profitability and consistency of the trend following strategies. The implications of the research suggest that these strategies can be valuable tools for traders seeking to capitalize on trends in the futures market.

Derek submitted the research Country Rotation Based On Regulatory Alerts Sentiment

Abstract: This tutorial explores four alternative data strategies that utilize the US Regulatory Alerts dataset to make trading decisions. The strategies include capitalizing on movement in the healthcare sector in response to FDA announcements, capturing momentum in the Bitcoin-USD trading pair based on new Crypto regulations, exploiting trading patterns in the SPY based on specific regulatory alerts, and a country rotation strategy using NLP to detect sentiment in country ETFs. The results show that all four strategies outperform their respective benchmarks. The tutorial also discusses NLP and its role in trading strategies, as well as the implementation of the four strategies using the LEAN algorithmic trading engine.

Derek started the discussion New Insight Manager and Updates for Risk Management Models

Hi everyone,

Derek started the discussion Plot Backtest Trade Fills in the Research Environment

Hi everyone!

Derek submitted the research Gradient Boosting Model

This tutorial focuses on training a Gradient Boosting Model (GBM) to forecast intraday price movements of the SPY ETF using technical indicators. The implementation is based on research by Zhou et al (2013), who found that a GBM produced a high annualized Sharpe ratio. However, the tutorial's research shows that the model underperforms the SPY with its current parameter set during a 5-year backtest. The tutorial concludes by suggesting potential areas of further research to improve the model's performance. The GBM is trained by iteratively building regression trees to predict pseudo-residuals and making predictions based on the learning rate and regression tree outputs. Technical indicator values are used as inputs, and the mean squared error loss function is used to assess the model's performance.

Derek submitted the research Sortino Portfolio Optimization with Alpha Streams Algorithms

QuantConnect provides trading infrastructure and data for quants to develop and deploy algorithmic trading strategies. They offer the Alpha Streams platform for quants to license their proprietary signals to investors. To assist investors in analyzing the performance of these signals, QuantConnect has released a new notebook that determines the optimal portfolio weights for each alpha, maximizing the portfolio's Sortino ratio. The Sortino ratio measures the strategy's average daily return in excess of a risk-free rate, divided by the standard deviation of negative daily returns. The notebook uses a walk-forward approach to avoid bias and overfitting, and the optimization is done on a rolling monthly basis.

Derek submitted the research Gaussian Naive Bayes Model

Abstract: This discussion focuses on the Gaussian Naïve Bayes (GNB) model and its application in forecasting the daily returns of stocks in the technology sector. The GNB model is trained using historical returns of the sector and compared to the performance of the SPY ETF over a 5-year backtest and during the 2020 stock market crash. The implementation of the GNB model shows a higher Sharpe ratio and lower variance compared to the SPY ETF. The algorithm used in this discussion is based on previous research and follows the principles of Naïve Bayes models. The GNB model assumes independence and normal distribution of feature vectors.

Derek started the discussion Strategy Library Addition: Gaussian Naive Bayes Model

Hi everyone,

Derek submitted the research Using News Sentiment To Predict Price Direction Of Drug Manufacturers

Abstract: This tutorial explores the use of news sentiment to predict the price direction of drug manufacturers. By implementing an intraday strategy, we aim to capitalize on the upward drift in stock prices following positive news releases. Our findings show that combining this effect with the day-of-the-week anomaly can lead to profitable trading during the 2020 stock market crash. However, our algorithm underperforms the S&P 500 market index ETF, SPY, during the same period. The algorithm is inspired by the work of Isah, Shah, & Zulkernine (2018). We conclude that while the sentiment analysis strategy may not provide accurate results in the US drug manufacturing industry, profitability can be achieved by restricting trading to the most profitable day of the week. The strategy produces a negative Sharpe ratio of -1.

Derek submitted the research Intraday ETF Momentum

This tutorial implements an intraday momentum strategy for trading actively traded ETFs. The strategy predicts the sign of the last half-hour return based on the return generated in the first half-hour of the trading day. The algorithm is a recreation of the research conducted by Gao, Han, Li, and Zhou (2017), which found that this momentum pattern is statistically and economically significant. The tutorial provides background information on the characteristics of the opening and closing periods of trading, as well as the selection of ETFs for the strategy. The conclusion states that the momentum pattern produces lower returns compared to the S&P 500 benchmark, but outperforms the benchmark during the downfall of the 2020 crash.

Derek submitted the research Ichimoku Clouds In The Energy Sector

Derek started the discussion Strategy Library Addition: Momentum in Mutual Fund Returns

Hi everyone,

Derek submitted the research Intraday Arbitrage Between Index ETFs

Derek started the discussion Strategy Library Addition: Intraday ETF Momentum

Hi everyone,

Derek submitted the research Momentum In Mutual Fund Returns

This discussion focuses on the momentum in mutual fund returns and the use of net asset value (NAV) as a predictor of future returns. The study suggests that historical returns and the proximity of NAV to a previous high can provide predictive power. The tutorial uses asset management firms' share prices as a proxy for fund performance and NAV. The performance of this trading strategy is compared to buying-and-holding the S&P 500 index ETF. The strategy generally has a lower Sharpe ratio than the benchmark, except during the 2020 stock market crash where it significantly outperformed with a Sharpe ratio of 9.3. The strategy also demonstrates more consistent returns compared to the benchmark across different testing periods.

Derek submitted the research Residual Momentum

Residual momentum is a strategy where stocks with higher monthly residual returns outperform those with lower returns. It has been found to have less exposure to Fama-French factors, higher Sharpe ratios, and better out-of-sample performance compared to total return momentum strategies. Residual momentum is also more stable throughout the business cycle and tends to underperform during trending periods but outperform during reverting periods. This strategy is less concentrated in small-cap stocks, leading to lower trading costs and minimizing the impact of tax-loss selling. The algorithm imports custom data, selects a universe of stocks based on fundamental data and market cap, and rebalances the portfolio monthly by longing the top 10% and shorting the bottom 10% of stocks based on their scores.

Derek left a comment in the discussion Can Crude Oil Predict Equity Returns

Hi Chris, the Nasdaq Data Link datasets that this research uses have been discontinued.

1 months ago