Finite-state machines

Finite-state machines

20 July 2023, 23:57
Vladimir Toropov
0
342

Finite-state machines (FSM) are mathematical abstractions that are used in the development of trading robots to model and control trading strategies and decision-making processes. If you want to develop a trading robot, but don’t know where to start, take a closer look at the finite-state machine. Any fully automatic Expert Advisor is based on this useful model.

Example

In fact, a trading robot is a program that can be in different states “Cash,” “Long,” or “Short,” like a traffic light that can be either “red,” “yellow,” or “green.”

A finite-state machine (FSM) is a simple model that describes how this machine or software moves from one state to another based on certain inputs or events.

The word “finite” in a finite-state machines means that there are only a limited number of states the machine can be in.

Using

FSMs are used in various real-world applications, like software programming, control systems, and even in everyday electronic devices, to describe and control the behavior of systems that can be in different states and respond to different events.


My solutions on MQL5 Market: Vladimir Toropov’s products for traders

In an FSM, the machine starts in an initial state, like “red” for a traffic light. When an event happens, like a timer going off or a button being pressed, the machine transitions to a new state. For example, when the timer runs out, the traffic light switches from “red” to “green.” Each state has specific rules or conditions that determine which state the machine goes to next.

Finite-state machines and trading robots

Of course, a trading robot can have more than three states. For example, it can be “Cash,” “Cash with a Limit Long order,” “Cash with a Limit Short order,” and much more. The set of states depends on your strategy.

In any case, when you decide on a set of states, all you have to do is program the rules for transitioning from one state to another. These rules will determine the Expert Adviser’s reaction to changing market conditions.

My solutions on MQL5 Market: Vladimir Toropov’s products for traders

Share it with friends: