THIS PAGE IS DEPRECATED!
State machines were used in the old Tester software (up to 0.9.5). New Tester 1.0 and above uses C++ for strategy definition.
Subscribe to download Smart Forex Tester 1.0. (It is still FREE!)
Any strategy testing tool must have means for the Forex trading strategy definition. It is quite natural when a programming language is used for that, like MQ4 in MetaTrader, or Visual Basic if you use MS Excel for testing.
However, programming language as such is not very convenient in the case you want to experiment with trading strategy. You can separate strategy parameters into an independent configuration file, but even a small change in the algorithm requires recompilation. Moreover, keeping track of changes in the code is not very easy for non-programmers. Usually software changes are stored in special revision control tools. But not everybody is comfortable enough with them.
We decided to use State Machines for trading strategy definition.
Forex Trading Strategy Definition as a State Machine
Any Forex trading strategy can be broken down to very limited set of states. Each state has a set of events which, once occur, result in transitions to other states.
Let’s take an example. We started trading – we are out of the market. This means an “Idle” state. Here we monitor the quotes coming from our data feed, and wait for our entry signals. When we get e.g. a BUY signal, we need to place a BUY order. In state machine terms, this equals to state change from state “Idle” to “Placing a BUY order“.
Once we got a confirmation from the trading terminal that our BUY order is filled, state changes to the “Long Unprotected“. After our stop loss order is filled, we enter a “Long protected” state.
So, each step and possible error situation in the trading strategy needs to be assigned a separate state which are changed based on predefined set of events. You can take a look into more details here: automated trading strategy as state machine.
State machines are often defined with XML. We started from this approach as well. But currently our software uses a plain text state machine for trading strategy definition. There are two main ideas behind the change.
First, we want to make the description even easier to use by an ordinary people without programming experience. And second, we would like to have means for automatic merging of multiple Forex trading strategies. This will open a way for genetic-like breeding and natural selection of trading strategies, which is a new and very interesting topic.
Want to try yourself? Download Smart Forex Strategy Tester