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.
- Navigate to the Models View: This is where you manage all your saved models.
- Click the "+ Model" Button: This opens the Model Builder, where you'll design your algorithm.
Loading Market Data
The side panel in the Model Builder contains all the controls for configuring your model.
Selecting an Asset
- Choose an Asset: Start by selecting an asset from the list of preloaded markets in Spectral Alpha.
Setting Bar Parameters
- Navigate to Market Settings: Click on the "Market Settings" tab in the side panel.
- Activate Time Period: Select the "Time Period" setting.
- Enter Value: Type in "60" to generate 1-hour bars for your chosen asset.
Generating the Chart
- 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
- Click the "Models" Button: This opens a library of pre-built models.
- Browse and Select: Explore the available models and choose one that aligns with your trading interests.
Exploring Model Configuration
- 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.
Loading the Model
- Click the "Load" Button: This adds the configuration of the pre-built model to your new model.
- Customize (Optional): You can adjust the settings of the loaded model to fit your specific needs or preferences.
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
- Click "Run Backtest": This initiates the backtest, and the engine will simulate trades based on your model's settings and the historical market data.
Analyzing Performance
- 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.
Exploring Trades
- View Executed Trades: You can examine the individual trades executed during the backtest, including entry and exit points, profits and losses, and associated costs.
- Run Statistical Analysis: Perform in-depth statistical analysis on your trades to gain further insights into your algorithm's behavior.
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.
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.