# Trading strategy

### Predictions through traditional algorithms

Python (and other programming languages) can be used to define trading strategies. Simple scripts using out of the box trading indicators can be composed very easily, are most likely non-competitive due to fierce competition. An example for a simple algorithm would be: if ema20 crosses ema 50 to the upside, go long.

Technotrading applies advanced mathematical calculations and formulas to define custom indicators that are resulting in superior trading signals. Technotrading trades perpetual contracts long and short, always uses a stop loss and take profit. Through its custom indicators and statistical approach, Technotrading anticipates larger moves in the markets to capitalize on it.

For all trading strategies, there are two KPIs for every trader or quantitative trading bot, that ensure long-term profitability. First, how often on average are your trades succeeding – your hit rate. Second, how much do you risk with every trade and how much return are you clocking in. That ratio is called the risk return ratio. Technotrading´s philosophy is to be very selective in the trades it is executing, leading to a high hit rate for automated trading systems. Only trades with an outstanding risk return ratio are taken and hence minimal portfolio drawdowns and high growth potential are ensured. Combining these rigorous, yet necessary trading specifics into algorithms can be considered as best practice.

***

### Predictions through AI

Compared to predictions through traditional algorithms, AI predictions are more challenging and require a lot more effort to master them. To envision the advanced level of complexity please view figure 1.

<figure><img src="/files/KgM1YgVnqC2ZNoPf0xBm" alt=""><figcaption><p>Figure 1</p></figcaption></figure>

At the core of our algorithmic trading system lies a robust AI pipeline designed to transform raw market data into actionable trading strategies. The process is divided into two main stages: training and inference.

**Training Phase**

We begin with historical raw price data for a specific asset, which is processed through our feature engineering module to extract meaningful indicators and patterns. These features are then formatted via a data loader and fed into our AI model for training. The model continuously learns and improves through iterative feedback loops, ensuring it adapts to evolving market dynamics.

**Inference Phase**

In real-time trading, a live data stream—typically candlestick data—is processed using the same feature engineering logic. The processed data flows through a data loader into the trained model, which generates predictions used to inform our trading strategy. This enables fast, intelligent execution in dynamic market conditions.

This end-to-end system ensures high accuracy in market predictions and seamless integration into our automated trading infrastructure.

***

### Training comparisons and improvement

To ensure transparency, reproducibility, and continuous improvement in our model development, we integrate Weights & Biases (wandb) into our training pipeline. wandb allows us to monitor key training metrics such as loss curves, validation accuracy, and parameter changes in real time. Each training run is logged and visualized through an interactive dashboard, enabling our team to compare experiments, track performance trends, and quickly identify areas for optimization. This level of visibility plays a critical role in refining our models and maintaining consistent model quality as we adapt to changing market conditions.

Figure 2 shows different graphs on wandb ai to track and compare different ai training runs.&#x20;

<figure><img src="/files/jKzu4L59UWrvrrwyr0XH" alt=""><figcaption><p>Figure 2</p></figcaption></figure>

During training, a range of validation metrics is tracked to assess how well the model generalizes to unseen data. Validation loss serves as a general indicator of prediction error on the validation set and is commonly used to monitor the model's convergence throughout training.

In addition to loss, several error metrics are used to provide more detailed insights into model performance. These include mean absolute percentage error (MAPE), symmetric mean absolute percentage error (SMAPE), and mean absolute error (MAE). MAPE and SMAPE are scale-independent and useful for evaluating relative errors, while MAE captures the average magnitude of absolute errors.

Visualizing these metrics over training epochs allows for effective comparison between different model runs, helping identify the most robust configurations for deployment.

***

### Plotting predictions

Following the training and validation process, custom plotting is used to visualize how the model performs on real market data. Figure 3 compares the actual Bitcoin price to the model's 45-minute-ahead predictions. The predicted values are shown both at their original prediction time and shifted forward to align with the target future points. This type of visualization helps evaluate the model’s ability to anticipate price movements in practical scenarios. By overlaying predictions with actual price trajectories, it becomes possible to assess the temporal accuracy and responsiveness of the forecasting model in live market conditions.

<figure><img src="/files/fwozCkEHot7eefxz6t6J" alt=""><figcaption><p>Figure 3</p></figcaption></figure>

***

### Algo Management System

Building upon the foundation of strategy development and signal calculation, our algorithmic trading management system, powered by [Freqtrade](https://www.freqtrade.io/en/stable/), incorporates robust tools for **backtesting** and **hyper optimization**. Backtesting enables us to evaluate the performance of our trading strategies against historical data, ensuring that the calculated signals translate into viable trades under real market conditions. Complementing this, hyper optimization systematically fine-tunes strategy parameters—such as indicator thresholds or time windows—to maximize performance metrics like Sharpe ratio or profit factor. These features allow us to iteratively improve our strategies before live deployment, ensuring they are both data-driven and performance-validated.

***

### Backtesting results

Feqtrade allows comprehensive backtests for crafted trading systems. Backtesting gives a clear picture how well the trading system would have performed in the past, has limited capabilities to predict the future. This is due to possibly changing market conditions, which result in a change in market structure. This change in market structure can result in a phenomenon called “drift”. The algorithms that worked in the past, start to drift and don't work as well in the present anymore.

Figure xyz shows some key KPIs of one of the prediction algorithms invented by Technotrading. The backtesting timeframe is from 1.9.2022 until 1.6.2025. A CAGR of around 370% would have been achieved by this trading system over the course of almost 3 years, which is a backtesting horizon, which can be considered as long in crypto. A total sum of 323 trades has been executed, making the backtesting sample size somewhat statistically significant. Other KPIs such as Sharpes and Sortinos are performant as well, indicating reliability and robustness of the trading system.

| Metric                          | Value                               |
| ------------------------------- | ----------------------------------- |
| Total Profit                    | 9252.749% \| 9252749.003 USDT       |
| CAGR                            | 371.616%                            |
| Sortino                         | 6.48                                |
| Sharpe                          | 1.40                                |
| Calmar                          | 3469.59                             |
| Expectancy (ratio)              | 28646.28 (1.14)                     |
| Profit factor                   | 2.827                               |
| Total trades / Daily Avg Trades | 323 / 0.3                           |
| Best day                        | 53.48% \| 1029482.086 USDT          |
| Worst day                       | -5.01% \| -139926.789 USDT          |
| Win/Draw/Loss                   | 121 / 0 / 202 (WR: 37.46%)          |
| Days win/draw/loss              | 116 / 778 / 171                     |
| Avg. Duration winners           | 2 days, 21 hours, 34 minutes        |
| Avg. Duration Losers            | 22 hours, 53 minutes                |
| Max Consecutive Wins / Loss     | 4 / 9                               |
| Rejected entry signals          | 435                                 |
| Entry/Exit timeouts             | 0 / 0                               |
| Canceled Trade Entries          | 0                                   |
| Canceled Entry Orders           | 0                                   |
| Replaced Entry Orders           | 0                                   |
| Long / Short                    | 242 / 81                            |
| Total profit Long               | 5107.489% \| 5107489.077 USDT       |
| Total profit Short              | 4145.260% \| 4145259.926 USDT       |
| Min balance                     | 94252.781 USDT                      |
| Max balance                     | 9383934.517 USDT                    |
| Market change                   | -48.987%                            |
| Max Drawdown (Account)          | 4.771%                              |
| Max Drawdown ABS                | 396782.98 USDT                      |
| Drawdown high / low             | 8259272.577 USDT / 7860489.597 USDT |
| Drawdown start                  | 2025-02-02 18:00:00                 |
| Drawdown end                    | 2025-02-17 13:00:00                 |
| Best Pair                       | AVAX/USDT/USDT 7001.165%            |
| Worst Pair                      | LINK/USDT/USDT 2251.586%            |

This is an example on what value for algo traders and strategists can be created through the Technotrading pipeline. Everyone with an algorithm or AI system, can easily backtest their algorithms, before putting them into production.

***

### Hyperoptimization

Freqtrade includes a powerful hyperparameter optimization framework that allows systematic tuning of trading strategy parameters. Using techniques like grid search or Bayesian optimization (via Optuna), it can efficiently explore combinations of strategy inputs—such as indicator thresholds, time periods, stop-loss values, and ROI targets—to find configurations that maximize performance metrics like profit, Sharpe ratio, or win rate or to find their optimal combination.

This process is fully automated and can be run on historical data to identify robust parameter sets before deploying a strategy live. Optimization runs are tracked and visualized, providing insights into parameter sensitivity and trade-offs. By leveraging this tool, strategy developers can refine and improve algorithmic performance in a structured, data-driven way.

Once the optimization is complete, the best-performing parameter sets can be saved and loaded directly into the strategy configuration. This allows traders to apply the most effective settings discovered during backtesting, ensuring the strategy is tuned for current or historical market conditions. Over time, this process can be repeated to adapt to changing market behavior, helping maintain a competitive edge in algorithmic trading.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://techno-trading-ai.gitbook.io/technotrading/trading-strategy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
