Back to articles
Statistical Edge: How to Know If Your Strategy Actually Works
How-To

Statistical Edge: How to Know If Your Strategy Actually Works

via Dev.to BeginnersPropfirmkey

Most traders confuse luck with skill. Here's how to use statistics to determine if your trading strategy has a real edge. The Null Hypothesis Start by assuming your strategy has no edge (null hypothesis). Then test whether your results are unlikely enough to reject that assumption. T-Test on Trade Returns from scipy import stats import numpy as np def test_trading_edge ( trade_returns ): """ Test if mean return is significantly different from zero. """ t_stat , p_value = stats . ttest_1samp ( trade_returns , 0 ) return { ' mean_return ' : np . mean ( trade_returns ), ' t_statistic ' : t_stat , ' p_value ' : p_value , ' significant_5pct ' : p_value < 0.05 , ' significant_1pct ' : p_value < 0.01 , ' num_trades ' : len ( trade_returns ) } # Example returns = [ 0.5 , - 0.3 , 1.2 , - 0.8 , 0.4 , - 0.2 , 0.9 , - 0.5 , 1.1 , - 0.7 ] * 10 result = test_trading_edge ( returns ) print ( f " P-value: { result [ ' p_value ' ] : . 4 f } " ) print ( f " Significant at 5%: { result [ ' significant_5p

Continue reading on Dev.to Beginners

Opens in a new tab

Read Full Article
0 views

Related Articles