guides

Building Your First Algo

Step-by-Step Guide

This guide will walk you through the process of creating your first trading algorithm in Spectral Alpha. We'll cover loading market data, using a pre-built model, backtesting, and exploring next steps.

Opening the Model Builder

To begin, you'll need to create a new model. A model encapsulates all the settings for your algorithm, including market data, indicators, trading logic, and parameters.

  1. Navigate to the Models View: This is where you manage all your saved models.
  2. Click the "+ Model" Button: This opens the Model Builder, where you'll design your algorithm.

open builder

Loading Market Data

The side panel in the Model Builder contains all the controls for configuring your model.

Selecting an Asset

  1. Choose an Asset: Start by selecting an asset from the list of preloaded markets in Spectral Alpha.

load asset

Setting Bar Parameters

  1. Navigate to Market Settings: Click on the "Market Settings" tab in the side panel.
  2. Activate Time Period: Select the "Time Period" setting.
  3. Enter Value: Type in "60" to generate 1-hour bars for your chosen asset.

bar settings

Generating the Chart

  1. Click "Get Bars": This instructs the engine to load the underlying asset data for your selected timeframe and generate bars based on your settings. You'll now see a chart of your chosen asset with 1-hour bars.

Loading a Pre-built Model

Spectral Alpha provides pre-built models that serve as excellent starting points for your own algorithms.

Exploring Pre-built Models

  1. Click the "Models" Button: This opens a library of pre-built models.
  2. Browse and Select: Explore the available models and choose one that aligns with your trading interests.

models viewer

Exploring Model Configuration

  1. Inspect the Model: Before loading a model, you can examine its indicators, parameters, and trading logic. This helps you understand how the model works and what makes it effective.

models explore

Loading the Model

  1. Click the "Load" Button: This adds the configuration of the pre-built model to your new model.
  2. Customize (Optional): You can adjust the settings of the loaded model to fit your specific needs or preferences.

models loading

Backtesting Your Algorithm

Now that you have configured your model, it's time to backtest it using Spectral Alpha's powerful trading engine.

Parameter Types

  • Fine-grained Control: You have granular control over the logic and parameters used in the backtest. This allows you to develop your algorithm incrementally, starting with simpler configurations and gradually adding complexity.

Running the Backtest

  1. Click "Run Backtest": This initiates the backtest, and the engine will simulate trades based on your model's settings and the historical market data.

run backtest

Analyzing Performance

  1. Open the Performance Panel: The panel at the bottom of the screen displays the performance of your backtest. You can analyze various metrics, such as net profit, drawdown, Sharpe ratio, and more.

show performance

Exploring Trades

  1. View Executed Trades: You can examine the individual trades executed during the backtest, including entry and exit points, profits and losses, and associated costs.
  2. Run Statistical Analysis: Perform in-depth statistical analysis on your trades to gain further insights into your algorithm's behavior.

view trades

Next Steps

Congratulations! You've built and backtested your first algorithm in Spectral Alpha. Now it's time to further refine and optimize your strategy.

Save your model! To unlock more advanced analysis such as optimisation and walk forward analysis.

Adjusting Parameter Values

  • Experiment with Parameters: Adjust the values of your model's parameters and re-run the backtest to observe how these changes affect performance. This helps you understand the sensitivity of your algorithm to different parameter settings.

edit paramsrun params

Training Parameters

  • Utilize the Optimization Engine: Employ Spectral Alpha's powerful optimization engine to automatically identify robust parameter values. This can significantly improve your algorithm's performance and stability.

Check out: the guide on how to train parameters