(DEMO) Stocks arent so hard without human error

(DEMO) Stocks arent so hard without human error

(DEMO ACCOUNT)
Refer to my previous post for statistics.

Live test within 4 days of running it, i obviously dont see it keeping this up all the time, but algos do much better than humans, anyway, any tips and suggestions?

u/Raiyyan7806 — 2 days ago

I made a strategy that makes 19% CAGR yearly

Hello, yesterday i was bored and decided to code my old strategys for fun, i tested one with sharia complaint stocks and it returned 20% CAGR (after tests and walk forward testing and roll forward), i didnt believe it and asked chatgpt to attack it every way possible, it stayed all night attacking my strategy againt metrics, the next lines are made by AI.
1. Baseline 10-year backtest
Monthly rebalancing
25 stocks
Equal-weighted
35% maximum sector cap
Shariah screening
Fixed factor rules/weights
0.10% transaction cost assumption
Historical period: roughly Sep 2016–Aug 2026
Original result: 30.93% CAGR
This was later discovered to have survivorship bias.
2. Point-in-time S&P 500 membership / survivorship-bias test
You replaced today’s S&P 500 membership list with companies that were actually members at each historical rebalance.
Result:
CAGR: 19.21%
Max DD: −32.20%
Volatility: 23.22%
Sharpe: 0.83
Sortino: 1.08
This was one of the most important tests because it knocked the headline return from ~31% to ~19%.

  1. Shariah-filter ablation test
    - Removed the Shariah filter while keeping everything else identical.
    - Shariah: 19.21% CAGR / -32.20% Max DD / 0.83 Sharpe
    - No Shariah: 16.26% CAGR / -39.02% Max DD / 0.63 Sharpe
    - In this specific sample, the Shariah screen improved both returns and risk metrics.
    - This does NOT establish that Shariah screening universally outperforms.

  2. Pure momentum test
    - Stripped the strategy down to 12–1 momentum.
    - Full strategy: 19.21% CAGR / -32.20% Max DD / 0.83 Sharpe
    - Pure momentum: 19.09% CAGR / -33.52% Max DD / 0.78 Sharpe
    - Most of the return appears to come from momentum.
    - The additional factors mainly improved risk characteristics rather than CAGR.

  3. Out-of-sample test
    - Development: Sep 2016–Dec 2021
    - OOS: Jan 2022–Aug 2026
    - Full strategy development CAGR: 19.98%
    - Full strategy OOS CAGR: 18.31%
    - OOS Max DD: -21.10%
    - OOS Sharpe: 0.79
    - OOS Sortino: 1.10
    - Pure momentum development CAGR: 17.10%
    - Pure momentum OOS CAGR: 21.46%
    - Neither strategy collapsed out-of-sample.

  4. Randomized portfolio test
    - 1,000 random portfolios.
    - Same universe, 25 stocks, sector cap, equal weighting, monthly rebalance and costs.
    - Random median CAGR: 14.40%
    - Random average CAGR: 14.46%
    - 5th percentile: 11.33%
    - 95th percentile: 17.78%
    - Minimum: 8.88%
    - Maximum: 21.74%
    - Actual strategy: 19.21%
    - Actual strategy was above the 95th percentile of random portfolios.
    - This provides evidence that the ranking adds value beyond simply selecting random stocks from the eligible universe.

  5. Transaction-cost sensitivity
    - Full strategy, everything else frozen.
    - 0.10% cost: 19.21% CAGR / -32.20% DD / 0.83 Sharpe
    - 0.25%: 18.03% / -32.25% / 0.78
    - 0.50%: 16.10% / -32.33% / 0.69
    - 1.00%: 12.32% / -32.50% / 0.53
    - 2.00%: 5.09% / -36.81% / 0.22
    - Performance degrades gradually rather than collapsing immediately.
    - At 1% costs, the strategy falls below 15% CAGR.
    - At 2%, performance becomes poor.

  6. Execution-timing test
    - Same-close: 19.21% CAGR / -32.20% DD / 23.22% vol / 0.83 Sharpe
    - Next-day open: 17.69% / -32.85% / 23.04% / 0.77
    - Same-day VWAP proxy: 17.94% / -34.01% / 22.76% / 0.79
    - Pure momentum next-day open: 17.44% CAGR / -34.12% DD / 0.72 Sharpe
    - Next-day execution reduced CAGR by ~1.5 percentage points but did not break the strategy.
    - The VWAP figure is only a typical-price proxy because true intraday VWAP data was unavailable.

  7. Rolling year-by-year stability test
    Full strategy:
    - 2019: +24.1%
    - 2020: +29.4%
    - 2021: +22.9%
    - 2022: -2.7%
    - 2023: +12.2%
    - 2024: +15.7%
    - 2025: +22.3%
    - 2026 YTD: +74.9% annualized pace

- 2022 was the major weak year.
- Full strategy beat momentum on CAGR in 4/8 years.
- Full strategy had shallower drawdowns in 6/8 years.
- 2026 YTD is annualized/pace data, not a true full-year result.

  1. Drawdown/recovery analysis
    - 11 distinct drawdown episodes deeper than 5%.
    - Historical next-day-open Max DD: -32.85%.
    - Major episodes:
    - 2018: approximately -16.1%
    - COVID: approximately -14.7%
    - 2021–22: approximately -10.8%
    - 2026: approximately -12.1%, unrecovered at the time
    - Longest losing streak: 3 months.
    - Longest winning streak: 11 months.
    - 2020 COVID decline recovered by August 2020.
    - 2022 was choppy and finished at -2.7%.

  2. Block bootstrap
    - 10,000 simulations.
    - 6-month blocks.
    - Based on the next-day-open execution series.
    - Actual CAGR: 17.69%
    - Median bootstrap CAGR: 17.52%
    - 5th percentile: 9.16%
    - 25th percentile: 14.04%
    - 75th percentile: 21.33%
    - 95th percentile: 27.30%
    - Median Max DD: -19.29%
    - Worst 5th-percentile DD: -29.22%
    - P(CAGR <5%): 0.54%
    - P(CAGR <10%): 6.90%
    - P(CAGR >15%): 68.35%
    - P(losing money over 10 years): 0.00% in the simulations.
    - The actual 17.69% CAGR was close to the bootstrap median.
    - Important limitation: bootstrap cannot create a bear market regime that wasn't present in the original sample.

  3. Capacity/liquidity test
    - 3,025 position-months across 121 rebalances.
    - Compared each position against its own trailing 63-day average dollar volume.
    - $10M portfolio: maximum participation 1.2%
    - $25M: 2.9%
    - $50M: 5.8%
    - $100M: 11.6%
    - At $100M:
    - 0.0% of position-months exceeded 10% ADV.
    - 0.0% exceeded 25% ADV.
    - Thinnest stock actually held: IR (Ingersoll Rand), January 2020.
    - Its trailing average daily dollar volume was ~$34.4M.
    - Capacity appears very strong for personally relevant/small institutional capital.
    - This does NOT replace real execution/slippage testing.

  4. Candle-quality / price-data test
    - Historical universe was subjected to candle-quality filtering.
    - No companies with usable financial data were excluded because of missing price data/candle quality in the survivorship investigation.
    - Price data therefore was not the major source of the survivorship problem.

  5. Remaining survivorship/data bias
    - Point-in-time membership correction substantially reduced the original result:
    - Current universe: 30.93% CAGR
    - Corrected point-in-time universe: 19.21%
    - Of 219 companies that left the S&P 500 since 2016, only 20 could be recovered with usable historical financial data.
    - 124/219 (57%) had no Yahoo market-cap data.
    - 169/219 (77%) failed the financial screen overall.
    - 30/219 (14%) failed the business-activity screen.
    - Therefore, residual bias almost certainly remains.
    - Complete point-in-time fundamentals is still the major unresolved backtest issue.
    - A paid historical fundamentals database may be required to properly resolve it.

CURRENT HONEST RESULT:
- Original backtest: 30.93% CAGR
- Corrected universe: 19.21% CAGR
- Realistic next-day-open execution: 17.69% CAGR
- Next-day-open Max DD: -32.85%
- Bootstrap median CAGR: 17.52%
- Bootstrap 90% CAGR range: ~9%–27%
- Randomized portfolio 95th percentile: 17.78%
- Actual strategy: 19.21%, above the 95th percentile
- OOS CAGR: 18.31%
- Capacity: strong
- Execution stress: passed, but not bulletproof
- Remaining major issue: incomplete point-in-time fundamentals
- Final real-world validation still needed: 3–6 months of paper/live execution to measure actual slippage and fills.

Human here: i put it on paper trading on IBKR, i want tips from seniors about the strategy i just made, thanks!

reddit.com
u/Raiyyan7806 — 7 days ago

Trading API

Hello, i have a FX Bot that runs on openrouter, i have a ton of requests a day (96*10,000 inp tokens) and would like a good cheap AI yall would recommend, I am testing the idea and dont have enough of money to spare on a good api, looking for something that balances my needs

reddit.com
u/Raiyyan7806 — 17 days ago

﴿يا أَيُّهَا الَّذينَ آمَنوا توبوا إِلَى اللَّهِ تَوبَةً نَصوحًا عَسى رَبُّكُم أَن يُكَفِّرَ عَنكُم سَيِّئَاتِكُم وَيُدخِلَكُم جَنّاتٍ تَجري مِن تَحتِهَا الأَنهارُ﴾

reddit.com
u/Raiyyan7806 — 19 days ago