AlgoHive
Getting Started

Your First Strategy

Build a simple moving average crossover strategy step by step.

Let's build a classic moving average crossover strategy together. This will teach you the fundamentals of AlgoHive's visual strategy builder.

What We're Building

A simple EMA crossover strategy that:

  • Buys when the fast EMA crosses above the slow EMA
  • Sells with a stop loss and take profit

Step 1: Create a New Strategy

  1. Navigate to Strategies in the sidebar
  2. Click Create New Strategy
  3. Name it "My First Strategy"
  4. You'll enter the Strategy Studio

Step 2: Add a Data Source

Every strategy needs market data to analyze.

  1. In the workflow editor, you'll see a Data Sources section
  2. Click Add Data Source
  3. Configure:
    • Alias: btc (a short name to reference this data)
    • Type: Exchange
    • Symbol: BTC-USD
    • Timeframe: 4h (4-hour candles)
  4. Click Add

You now have a data source node showing BTC-USD price data with columns: open, high, low, close, volume.

Step 3: Add Analysis Blocks

Now let's calculate moving averages and detect crossovers.

  1. Click Add Analysis in the toolbar
  2. Select Advanced Block (for multiple outputs)
  3. Name it signals
  4. Add these outputs:
fast_ema: EMA(btc.close, 9)
slow_ema: EMA(btc.close, 21)
cross_up: cross_above(fast_ema, slow_ema)

This creates:

  • A 9-period EMA of the closing price
  • A 21-period EMA of the closing price
  • A signal that fires when the fast crosses above the slow

Step 4: Add an Entry Rule

  1. Click Add Entry in the toolbar
  2. Configure:
    • Direction: Long
    • Market: btc (your data source)
    • When: signals.cross_up
  3. Click Add

Now your strategy will enter a long position whenever the fast EMA crosses above the slow EMA.

Step 5: Add Risk Management

  1. Click Add Manage Rule in the toolbar
  2. Add a Stop Loss:
    • Type: Stop Loss
    • Level: 5% (percentage from entry)
  3. Add another rule for Take Profit:
    • Type: Take Profit
    • Level: 3R (3x the risk)

Step 6: Connect the Manage Rules

Drag from your Entry node to each Manage node to link them. This tells AlgoHive which rules apply to which entries.

Step 7: Backtest

  1. Click Lab in the top navigation
  2. Set your backtest parameters:
    • Start Date: 1 year ago
    • End Date: Today
    • Initial Equity: $10,000
  3. Click Run Backtest
  4. Review results:
    • Equity curve
    • Win rate
    • Max drawdown
    • Individual trades

Step 8: Iterate

Based on your backtest results, you might want to:

  • Adjust EMA periods
  • Add filters (e.g., only trade when RSI < 70)
  • Change stop loss/take profit levels
  • Add multiple timeframes

Step 9: Paper Trade

When happy with backtest results:

  1. Click Deploy
  2. Select Paper mode
  3. Configure alerts (optional)
  4. Click Deploy

Your strategy is now running in paper mode, tracking real market conditions without risking real money.

Step 10: Go Live

After validating in paper mode:

  1. Go to Deploy tab
  2. Click Switch to Live
  3. Confirm you understand the risks
  4. Your strategy is now trading with real funds

Summary

You've built a complete trading strategy:

  1. Data Source — BTC-USD 4h candles
  2. Analysis — EMA crossover detection
  3. Entry — Long on cross_above signal
  4. Risk — Stop loss and take profit

Next Steps

On this page