Vai al contenuto

AiBridge: Bridging the financial and scientific communities

In a previous article, we illustrated how AiBridge technology, an API that connects Python to TradeStation/Multicharts, currently in development with the support of the “Gandalf Project” can be used to analyze and trade a genetic portfolio across the entire S&P 500 using TradeStation charts, indicators, and strategies.

In this article, we will shift the focus to the 9 US sector ETFs and analyze the Out of Sample results of the genetic model through Multicharts.

Fig.1: AiBridge Indicators and Strategies on Multicharts Sectors Etfs Charts

As you can see from the charts above, we have programmed a Powerlanguage indicator to draw a histogram whenever the genetic portfolio, always in Out of Sample mode, indicates a risk-ON situation.

The chart also applies strategies that, in the basic model, simply replicate the signal provided by the genetic portfolio, buying on risk-ON and selling on risk-OFF. As we will see, this basic strategy can be adapted in various ways for both trading and asset management objectives.

Now, let’s move on to the Multicharts Portfolio Trader, where we will conduct a comparative analysis between the following two approaches:

  1. Buy & Hold analysis with equal sizing on the 9 sector ETFs
  2. Performance analysis of the base AiBridge genetic model

After activating the AiBridge API to import the Out of Sample results of the genetic model into the Multicharts Portfolio Trader, we set the Portfolio Trader with the following parameters:

Initial Portfolio Capital: 900,000 USD
Size per Trade: 100,000 USD
No Commissions, no slippage
Out of Sample Period: January 2014 — May 2024

Fig.2: Multicharts Portfolio Trader with Strategies from the AiBridge API

Buy & Hold Analysis with Equal Sizing on the 9 Sector ETFs

Below you will find the Performance Summary and Equity Line produced by the Multicharts Portfolio Trader for the Buy & Hold strategy with equal sizing on the 9 US sector ETFs.

Fig.3: Buy & Hold 9 Sectors ETF: Multicharts Portfolio Trader Performance Summary

Fig.4: Buy & Hold 9 Sectors ETF: Multicharts Portfolio Trader Equity Line

Performance Analysis of the Base AiBridge Genetic Model

Below, we present the performance analysis of the base AiBridge genetic model, as produced by the Multicharts Portfolio Trader. This analysis provides insights into how the genetic model performed during the Out of Sample period, showcasing its ability to identify risk-ON and risk-OFF situations and the resulting impact on the portfolio’s performance.

Fig.5: AiBridge 9 Sectors ETFs: Multicharts Portfolio Trader Performance Summary

Fig.6: AiBridge 9 Sectors ETFs: Multicharts Portfolio Trader Equity Line

Let’s summarize the key performance indicators calculated by Multicharts in the following table:

Fig.7: 9 ETFs Sectors: Buy&Hold vs AiBridge Base

The combined use of Python and TradeStation (or Multicharts, as in this case) allows for easily conducting purely financial evaluations that would otherwise be difficult for those who do not program in Python. For instance, based on the table above, we can observe that:

  • The AiBridge Base model loses 38% in terms of Total Return compared to the Buy & Hold strategy but, in return, reduces the Maximum Drawdown by 45%.
  • The AiBridge model, in terms of Annual Rate of Return, loses 4%, but reduces the incidence of Maximum Drawdown on the initial capital by 11%.


One of the main objectives of AiBridge is to enable the financial community to quickly evaluate complex genetic models and/or AI models built in Python. In this article, we have attempted to apply the AiBridge_100 genetic model, a genetic portfolio constructed in Python on the 100 most capitalized stocks of the S&P 500, to the 9 sector ETFs.

In light of all this, the model, from a trading perspective, seems to hold up well against the Buy & Hold strategy in terms of the Risk-Return ratio.

In the coming weeks, we will try to use the same genetic model in conjunction with some dynamic asset allocation techniques.

Domenico D’Errico

EasyLanguage PowerLanguage Specialist

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *