Discussing the article: "Self Optimizing Expert Advisors in MQL5 (Part 13): A Gentle Introduction To Control Theory Using Matrix Factorization"

 

Check out the new article: Self Optimizing Expert Advisors in MQL5 (Part 13): A Gentle Introduction To Control Theory Using Matrix Factorization.

Financial markets are unpredictable, and trading strategies that look profitable in the past often collapse in real market conditions. This happens because most strategies are fixed once deployed and cannot adapt or learn from their mistakes. By borrowing ideas from control theory, we can use feedback controllers to observe how our strategies interact with markets and adjust their behavior toward profitability. Our results show that adding a feedback controller to a simple moving average strategy improved profits, reduced risk, and increased efficiency, proving that this approach has strong potential for trading applications.

Financial markets can often prove difficult to plan for or anticipate in advance. Investor sentiment is often fragile and can shift quickly depending on the global climate and the pressing issues dominating current affairs. Therefore, trading strategies that appear profitable in a historical context can often fall apart when deployed in real-time markets.

There are many reasons we can use to explain this behavior in trading applications. However, one key understanding is that once our applications have been developed and deployed, their behavior remains fixed and cannot usually be modified without human intervention. This means our strategies are vulnerable to repeating the same mistakes over and over again without ever profiting from failure or learning from past mistakes.

Figure 1: The normal trading setup used to deploy trading applications in finacnial markets

There have been many proposed solutions to this recurring problem. However, one solution that holds great potential comes from the field of control theory. Control theory is primarily concerned with correcting the behavior of a system operating in a dynamic or chaotic environment, with the goal of realigning the system toward a defined objective.

By periodically feeding back a copy of our strategy’s performance to a feedback controller—one that records and observes how the strategy interacts with the markets—we may be able to approximate the relationship between our strategy’s behavior and market outcomes. This controller aims to identify dominant patterns correlated with both losing trades and winning trades. If such a structure exists, and we can learn from it, then in theory the feedback controller should be able to modify and guide the dynamics of our trading system toward profitability, even during chaotic and ever-changing market conditions. 

This will effectively change out strategy's deployment structure from the schematic diagram depicted in Figure 1. In figure 2, we introduce the reader to simple notation used in control thoery literature and denoted the market's input signals as (M) and our strategy's outputs are denoted as (S).

Figure 2: We can redifine our trading application using shorthand notation to represent the market inputs (M), and the strategy output (S)

Author: Gamuchirai Zororo Ndawana

 
You did not attach the volatilityDoctor/Time..Trade include files. Your submission can not be tested without the two include files. 
 
Majeed Odubela #:
You did not attach the volatilityDoctor/Time..Trade include files. Your submission can not be tested without the two include files. 
Majeed I'm sorry to hear about your experience. 

However you must also understand that this article is part of a larger family of related series that build upon each other.

The class you are looking for was built and attached completely from scratch, in an earlier article.