> ## Content Index
> Fetch the complete content index at: https://blog.alphainsider.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How I Used AI to Build a Hedge Fund of Trading Strategies
- URL: https://blog.alphainsider.com/how-i-used-ai-to-build-a-hedge-fund-of-trading-strategies/
- Published: 2026-08-05T15:46:58.000Z
- Updated: 2026-08-05T15:46:58.000Z
- Description: See how AI-built trading strategies performed in backtests, why a losing strategy may be gold, and how to forward test them on AlphaInsider.
- Author: Alpha Insider
- Tags: alphainsider, Algorithmic Trading, AI trading bot, trading bot, Trading Automation, alphainsider automation, AI hedge fund, hedge fund

What happens when you ask AI to build you an entire portfolio of algorithmic trading strategies — not just one, but a diversified set that trades different assets in different ways, like a miniature hedge fund? Over the past couple of weeks, that's exactly the experiment we've been running at [AlphaInsider](https://alphainsider.com), using Claude to generate **AI trading strategies** in Pine Script and testing them against years of market data.

The results are a mixed bag — and that's the honest, interesting part. Some strategies work. One died completely. And one lost money for six straight years across multiple assets, which sounds like a total failure but might actually be the most useful discovery in the entire set.

In this article, we'll break down three of the core strategies, explain why a consistently losing strategy can be flipped into a potential edge, and walk through the exact process of connecting a TradingView strategy to AlphaInsider for live forward testing.

## Table of Contents

- [Key Takeaways](#key-takeaways)
- [Backtests vs. Forward Tests: The Ground Rules](#backtests-vs-forward-tests)
- [Why the Backtesting Window Stops Around 2020](#why-backtesting-stops-at-twenty-twenty)
- [Strategy S10: The Gap Fill Strategy](#gap-fill-strategy)
- [Strategy S9: VWAP Trend Day Continuation](#vwap-trend-day-continuation)  
  - [Why a Losing Strategy Might Be the Best Find](#why-a-losing-strategy-might-be-the-best-find)
  - [The Slippage and Commission Trap](#the-slippage-and-commission-trap)
- [Strategy S6: The Initial Balance Breakout](#initial-balance-breakout)
- [How Three Strategies Become Twenty or Thirty](#how-three-strategies-multiply)
- [How to Forward Test a TradingView Strategy on AlphaInsider](#how-to-forward-test-on-alphainsider)
- [What Happens Next](#what-happens-next)
- [Frequently Asked Questions](#frequently-asked-questions)
- [Conclusion](#conclusion)

## Key Takeaways

- **AI can generate complete algorithmic trading strategies** — one of the strategies in this experiment runs on roughly 583 lines of Pine Script, loaded straight into TradingView.
- **Backtests are not proof.** Every result shown here is a backtest, and none of these strategies gets a dollar of real money until it survives a live forward test.
- **A consistently losing strategy can be valuable.** By inverting the executions (selling when it says buy, and vice versa), a strategy with a strongly negative edge could become a positive one.
- **Slippage and commissions can fake an edge.** A "bad" strategy might only look bad because of trading costs — remove them from the backtest before deciding whether the inverse is worth trading.
- **Asset selection matters as much as logic.** The same strategy produced great results on IWM, mediocre results on SMH, and roughly break-even results on SPY and QQQ.
- **Three strategy logics can become 20–30 tracked strategies** once you factor in inverse versions and multiple ticker symbols.
- **Forward testing on AlphaInsider is webhook-driven** — TradingView alerts fire into an AlphaInsider strategy so every trade is tracked in real market conditions.

## Backtests vs. Forward Tests: The Ground Rules

Before looking at any results, one thing needs to be crystal clear: **everything in this experiment is a backtest**. A backtest shows how a strategy's logic *would have* traded on a specific asset over a specific period of time. It is not a guarantee — or even strong evidence — that the strategy will perform the same way going forward.

That's why none of these strategies is getting real money yet. Instead, every promising (and some deliberately unpromising) strategy gets a **forward test**: it runs live, in real time, in real market conditions, so we can see whether trades that look great on a historical chart actually pan out in reality.

The plan is simple:

1. Let the forward tests run for a couple of weeks.
2. Gather enough live data to compare against the backtests.
3. Review the results, add new strategies along the way, and then move toward building a trading bot that trades live funds.

## Why the Backtesting Window Stops Around 2020

The backtesting process here followed a consistent pattern: first look at roughly the past 365 days, then extend back a couple of years, then generally go back to about 2020.

Why stop there? Because going beyond 2020 puts you in the **pre-COVID market environment**, which is arguably a fundamentally different market altogether. On top of that, it's extremely rare for a single set of logic to stay consistently profitable for six-plus years — let alone decades.

That doesn't mean a strategy needs to be rebuilt from scratch as markets shift. But it does mean adjustments are inevitable, and at some point manual work is going to be required. Expecting one frozen ruleset to print money forever is not realistic.

## Strategy S10: The Gap Fill Strategy

S10 is the newest strategy in the portfolio — built just the night before this video was recorded. The core idea:

- **Small gaps tend to fill.**
- **Large gaps tend to run.**
- Most of the action happens in the **9:30–10:30 a.m. Eastern window**.

The strategy has multiple modes inside its logic and weighs in at approximately **583 lines of Pine Script**, loaded directly into TradingView. After adjustments and settings changes, the result is a strategy curve that slopes **up and to the right consistently over roughly the past six years**, with a **profit factor of 1.245**.

Two important caveats on those numbers:

- **No commissions** are assumed — the broker planned for automation doesn't charge them.
- **No slippage** is assumed either. Rather than guessing, the forward test will reveal the average slippage in live conditions, and that real number can then be plugged into future backtests.

Asset selection made a huge difference here:

| Asset | Result with S10                      |
| ----- | ------------------------------------ |
| IWM   | Best correlation — strongest results |
| SMH   | Some consistency                     |
| SPY   | Close to break even                  |
| QQQ   | Close to break even                  |

Same logic, four different outcomes. This is a recurring theme: a strategy isn't "good" or "bad" in a vacuum — it's good or bad *on a specific asset and timeframe*.

## Strategy S9: VWAP Trend Day Continuation

S9 is built on a classic intraday concept: **days that pick a direction tend to hold that direction**. The strategy uses VWAP as support in an uptrend and resistance in a downtrend — buy the pullback into VWAP, then ride the continuation.

That's an oversimplification, of course. Under the hood there are settings for timing, trend qualification, pullback qualification, position sizing, stops, and take profits — all of which were adjusted during testing.

Here's where it gets interesting. S9 performed **poorly on SMH** (the semiconductor ETF) over the past couple of years, and on **XLE** (the energy ETF) it performed badly on essentially every timeframe from 3-minute charts to 30-minute charts. The 3-minute chart was the standout — in the worst way — with a **profit factor of 0.647**.

### Why a Losing Strategy Might Be the Best Find

A strategy that loses that consistently is potentially more valuable than a mediocre winner. Here's the logic:

- A strategy with a **0.9 profit factor** loses money, but only slightly. Once you add slippage and other real-world frictions, inverting it (doing the exact opposite) might land you near break even — meaning there was **no real edge in the first place**.
- A strategy with a **substantially negative** profit factor, however, is essentially the mirror image of a solid winner. Invert it, and that strong negative edge could become a strong positive one.

In practice, the inversion is done at the execution level, not by rewriting the logic. A couple of extra lines of code in the Pine Script make it possible to create **two alerts from one strategy**: the strategy as-is, and an "inverse" version toggled on. When the original executes a buy, the inverse executes a sell. When the original closes its long at the end of the day, the inverse buys to close its short.

So in theory, you can deliberately **optimize for terrible trading strategies** — the more negative the edge, the better — and then flip them into candidates for a positive edge.

### The Slippage and Commission Trap

There's a catch, and it's a big one: **trading costs baked into the backtest can manufacture a fake negative edge**.

When the XLE backtest included two ticks of slippage plus commissions, the strategy looked absolutely horrible. Strip out the commissions and set slippage to zero (hypothetically), and the picture changes: the strategy averages out to a **0.95 profit factor**. That's far too close to 1.0 to be worth inverting — the "edge" was mostly just costs.

But adjust the test window to start in 2021 — removing the period where the strategy actually did well — and the profit factor drops to **0.819**. That's substantially more interesting as an inversion candidate.

The lesson: before you get excited about inverting a losing strategy, make sure the losses come from the *logic*, not from commissions and slippage assumptions.

## Strategy S6: The Initial Balance Breakout

S6 trades breakouts from the initial balance — the range established early in the trading session. The best correlation showed up on **Tesla on the 15-minute timeframe**, and the results held up elsewhere:

- **5-minute timeframe:** profit factor of 1.4 over the past couple of months.
- **3-minute timeframe:** still profitable.

All good signs. Even better, similar settings showed slight correlations on other large-cap names: **Google, AMD, Amazon, Microsoft, Apple, and Meta**. Those tickers will be added to the strategy list as the forward-testing portfolio expands.

## How Three Strategies Become Twenty or Thirty

Here's the multiplication effect that makes this approach feel like building a hedge fund rather than trading a single system. From just these three strategy logics, you can easily generate **20 to 30 distinct trading strategies** to track, because each one branches into:

- **Multiple ticker symbols** (IWM, XLE, Tesla, the mega-cap names, and more)
- **Multiple timeframes** (3-minute, 5-minute, 15-minute)
- **Inverse versions** of the losing configurations

Every combination becomes its own tracked forward test, generating its own live data.

Want to forward test your own strategies?

Create a free AlphaInsider account and track every trade in real market conditions.

[Get Started Free →](https://alphainsider.com) 

## How to Forward Test a TradingView Strategy on AlphaInsider

This is the step-by-step process for [connecting a TradingView strategy to AlphaInsider](https://youtu.be/JHjVjc42Mxw) so every signal is tracked as a live forward test.

**What you'll need:**

- A TradingView plan that supports webhook alerts (open-ended alerts require a higher-tier plan)
- An AlphaInsider account with an API token
- A strategy loaded on your chart with your chosen settings and timeframe

**Step-by-step:**

1. **Set up your chart.** Load the strategy, dial in your settings, and put it on the timeframe you want to test.
2. **Create the alert.** Click the three dots on the strategy, then **Add Alert**. Set the condition to the strategy, same as chart, on your timeframe. Setting the alert to open-ended requires a higher TradingView tier.
3. **Create the strategy on AlphaInsider.** Go to your portfolio and click **New Strategy**. Name it — if you're using your saved default settings, name it accordingly so you can track configuration changes later. Set a hypothetical starting balance (the amount doesn't matter; it's just for tracking performance over time). Choose "stock strategy," and consider making it **private** while it's unproven, so nobody can follow an untested strategy.
4. **Open the connection guide.** On the new strategy's page, click the three dots and go to **Connections**. This shows the step-by-step guide, including the **AlphaInsider webhook URL** and the block of alert text you need.
5. **Paste the webhook URL** into the TradingView alert's webhook field.
6. **Paste the message block** into the alert message. The strategy ID is generated for you — it's the string after the final slash in the strategy's URL.
7. **Fill in the remaining fields:**  
  - **Stock ID:** scroll down to New Order on AlphaInsider, type the ticker (e.g., Tesla), and copy the stock ID from the first result into the quotes.
  - **Leverage:** up to 2x is available; starting with 1 is the conservative choice.
  - **Pyramiding:** set to 1 if the strategy doesn't pyramid.
  - **API token:** grab it from AlphaInsider's developer settings. Create one there if you don't have one yet, and save it — you can reuse it for every future strategy.
8. **Name the alert** the same as the strategy name on AlphaInsider so everything stays matched up.
9. **Turn notifications off** if you're running many strategies — dozens of alerts firing daily will otherwise blow up your phone.
10. **Click Apply, then Create.** Check your alerts list — the strategy should now be active, and every future trade will fire straight into AlphaInsider.

Then repeat the process for every strategy, ticker, and timeframe you want to track.

## What Happens Next

The portfolio currently holds **17 strategies**, and that number should at least **double, if not triple**, before the next update. New strategies are being added essentially every day — new logics, new tickers, new inverse versions — with the three core strategies above remaining the priorities.

The roadmap for this series:

1. **Now:** forward tests running live, gathering real-world data.
2. **Next video:** a recap of which strategies actually worked, which didn't, and what the live data says about slippage.
3. **After that:** building out a trading bot that trades live funds.

## Frequently Asked Questions

### Can AI really build a working trading strategy?

AI (in this case, Claude) can absolutely generate complete, functional strategy code — one strategy here is roughly 583 lines of Pine Script. Whether the strategy is *profitable* is a separate question that requires backtesting, settings adjustments, and ultimately live forward testing to answer.

### What's the difference between a backtest and a forward test?

A backtest shows how a strategy's logic would have traded on historical data. A forward test runs the strategy live, in real time and real market conditions, without real money. Forward testing reveals problems backtests hide — like actual slippage.

### What is a profit factor?

Profit factor is gross profits divided by gross losses. Above 1.0 means the strategy made money over the tested period; below 1.0 means it lost. A 1.245 profit factor (like S10 on IWM) is a solid positive result, while 0.647 (S9 on XLE) is a strongly negative one.

### Why would anyone want a losing strategy?

Because a consistently, strongly losing strategy can be inverted — executing the opposite of every signal — potentially turning a negative edge into a positive one. The key word is *strongly*: a strategy that only loses slightly will likely just become break-even after costs when inverted.

### How does inverting a strategy work?

The inversion happens at the execution level, not in the logic. A couple of extra lines of Pine Script enable an "inverse" toggle when creating alerts: when the original strategy buys, the inverse sells; when the original exits its long, the inverse buys to close its short.

### Why not backtest further back than 2020?

The pre-COVID market is arguably a fundamentally different environment, and it's extremely rare for one set of logic to stay profitable across six-plus years without adjustments. Testing across the recent regime — roughly one year, then a few years, then back to about 2020 — gives a more relevant picture.

### Should slippage and commissions be included in a backtest?

Eventually, yes — but with real numbers. In this experiment, slippage was set to zero so the forward test could reveal the *actual* average slippage, which can then be fed back into future backtests. The danger of guessing is that costs can make a strategy look like it has a negative edge when it really doesn't.

### Do strategies perform the same on every asset?

No — and the differences are dramatic. The gap fill strategy was strong on IWM but roughly break-even on SPY and QQQ. The initial balance breakout worked best on Tesla but showed only slight correlations on other mega-cap stocks. Always test the specific asset and timeframe you plan to trade.

## Conclusion

Asking AI to build a hedge fund's worth of **AI trading strategies** produced exactly what an honest quant process should: a few genuine candidates, a dead strategy, and a six-year loser that might be the most valuable find of all once inverted. But none of it means anything until the forward tests deliver real-world data — which is exactly what's running right now, live, on AlphaInsider.

If you want to run this playbook yourself, create your AlphaInsider account, connect your TradingView strategies via webhook, and start forward testing before you risk a single real dollar. And make sure you're subscribed to the [AlphaInsider YouTube channel](https://www.youtube.com/channel/UC4QnJ%5FAhYMgALFUraWlm3JA/) so you don't miss Part 2 — the results recap, and the start of building a live trading bot.