1 Introduction

The largest share of foreign exchange market profits, especially foreign exchange (FOREX) market profits [1], derives from extended margin-based leveraging [2]. Leverages as high as 1–200 (i.e., someone with an initial capital of 1000 € is allowed to risk a capital of 200,000 €) is a source of high risk for investments of low volatility (on the same day and sometimes between a few minutes). Therefore, it has been argued that it is essential for forecasting models as well as the accompanying systems of algorithmic trading [3] be based on short time periods.

Economists have been trying for several decades to build models for successfully forecasting trends. These efforts gave birth to the field termed as technical analysis. Despite a large number of long and arduous attempts, no indicator or model of a sufficiently generic nature has been developed so far that can forecast with great success the trend of the financial markets. The main reason for this is that technical analysis does not take into account the most recent changes of fundamentals, which have not been yet recorded, nor the effect of breaking news on the psychology of investors. Moreover, examining technical analysis indicators and their usage in trading [4] requires so much time that the appreciation of short-term (sometimes, within seconds) changes in exchange rates is rendered practically impossible. In markets of considerable depth and volume, such as the FOREX one, exploiting micro-changes within a minimum time frame is of paramount importance and can be achieved with ultra-short-term trading [5].

The aim of this work is the design and implementation of a trend forecasting and transaction system in FOREX, which will be able to take into account the micro-changes in the exchange rates and carry out ultra-short-term transactions. To develop trend forecasting, we build a series of appropriately designed and configured simulators of technical indicators [6], which are then fed into an artificial neural network (ANN) [7], based on an earlier architecture [8]. The forecasting signals as well as the technical indicators supply a series of automatic trading machines. Based on a comprehensive simulated experimentation, we review the most successful configurations and associate their maximum (simulated) profits by tracing their performance back to the techniques used for generating the trend forecasts. In doing so, we address the non-trivial problem of integrating a trend prediction mechanism with a transaction one; in the FOREX practice, having access to a quality forecast does not necessarily mean that you will make a good decision based on it (you might postpone a decision expecting your profit to go beyond a point in time where you are no longer able to conclude a transaction or you may hurry towards a decision that will leave you with a loss). So, a particular contribution of this work is that it closes the loop from information to action.

The rest of this paper is structured in four subsequent sections. We first briefly review related work on predicting exchange rates using computational intelligence. Then, we describe the proposed system architecture and we proceed with presenting and analyzing the experimental results, before concluding, in the last section, where we also set out a couple of future work directions.

2 A brief background on predicting exchange rates using computational intelligence

As earlier mentioned, in FOREX, traders use technical analysis tools [6] to predict the exchange rates but higher profits are usually achieved by automated systems [3] which trade huge sums of money based on forecasting models. However, automated systems also tend to follow the “avalanche” model [5] by training each other and thus re-enforce ascending or descending trends. In shallow markets, such models may lead to significant distortions. A typical example is the stock market crash of Monday October 19, 1987 (Black Monday), with the resulting sell-off in the S&P 500 and the Dow Jones generating a price fall in excess of 20%. A particular automated trading system exacerbated the sell-off by attempting to hedge a portfolio of stocks against market risk by short-selling stock index futures and by automatically beginning to sell stocks as stop loss targets were hit, triggering a domino effect of other programs following suit and falling prices triggering further stop loss orders.

Technical analysis methods have resulted both in successes and failures. Failures are usually due to undetected changes in fundamental values and market psychology and forecasting inaccuracies tend to increase with shorter-term forecasting [9].

A demonstration of how to efficiently approach the problem of automated trading with large portfolio strategy that continuously consumes streams of data across multiple diverse markets appears in [10], where a simple scalable trading model that learns to generate profit from multiple inter market price predictions and markets' correlation structure is presented.

Forecasting methods are broadly divided into two categories, traditional and non-traditional. Traditional ones are usually based on static algorithms, which are not altered and are not influenced by input data [11]. Basically, these are econometric models which help us interpret the results. Furthermore, they allow hypothesis control, which is a standard quality assurance procedure in technical analysis [11].

Νon-traditional methods include all methods which are based on data and auto-correct themselves [11]. Such methods are based on fuzzy logic [12], on artificial neural networks (ANN) [8], neuro-fuzzy architecture (hybrid systems) [13] and genetic algorithms [14]. Non-traditional methods can be quite competitive to econometric methods, due to the generalized operations they perform [15]. While they can function as general models, they do not guarantee satisfactory results; nevertheless, they are usually better than conventional models where data is associated with linear relationships [15] especially when modeling the market response.

Machine learning-based methods have been extensively used for predicting trading patterns and are considered strong enough to deal with FOREX forecasting based on past trading data [8].

Furthermore, the hidden layers of ANN systems represent an internal representation of relations between variables and, as a result, they do not satisfy certain prerequisites required by palindromic models, such as variability between epochs, smoothness of background noise, etc. Neural networks can also perform quite well in cases of sparse data, as opposed to regression models where serious problems arise [16]. Moreover, neural networks are suited to complex phenomena for which satisfactory performance measures do exist but there is limited knowledge of the relationships between these phenomena. They are also relatively successful for forecasting and prognosis [16]. Additionally, genetic algorithms have been also used to learn trading rules and, then, combined with an echo state network to predict the market trend [14], with results demonstrating better results both on bull and bear markets compared to the usual buying and holding strategy of retail traders.

We now briefly review some key contributions to the field.

Yong et al. [17] examined the closing price as well as the various closing price technical indicators to determine their impact on the FOREX trend provided by a machine learning module.

Abraham et al. [18] attempted to compare the performance of a Takagi Sugeno Type neuro-fuzzy system to that of a neural network to predict the average monthly exchange rate values. The Australian dollar was used as the basis and its exchange rates with the US dollar, the Singapore dollar, the New Zealand dollar, the yen and the pound sterling. It was reported that the proposed models were able to predict average exchange rates but only when dealing with a time horizon of at least one month.

Wang et al. [19] have shown that a neural network with three layers combined with an auto-regressive integrated moving average mode outperforms the global modeling techniques in terms of profit returns.

Vanstone and Finnie [20] presented a methodology for the design of robotic trading systems using artificial neural networks. They outlined the key steps (selecting inputs and outputs, partitioning available data, determine architecture, setting threshold and stop trading signals, real world constraints and benchmarking) for building a neural network to be used in stock trading.

A hybrid model was developed by Ni and Yin [21], consisting of a mix of different neural network models (mostly unsupervised learning) and simulators of technical indicators to predict exchange rates. The model uses some of the most popular technical indicators such as the moving average [6], convergence/deviation, and the relative resistance index (RSI) [6]. A genetic algorithm is used to "mix" the forecastings of the generators and the technical neural networks, producing the overall system forecasting.

The combination of neural networks with technical analysis, and, in particular, the relative resistance index (RSI), has been used to improve the trading systems [22] of the IBEX-35 stock index.

Further experiments with two other indicators, the weighted moving average and the momentum [6], have shown that, when fed into a technical neural network, they produce a better forecast compared to the original (i.e., the forecast produced by the indicator before being introduced into the artificial neural network) [23].

Khirbat et al. [24] studied the forecasting of stock market prices by feeding the time series of stock prices to a multilayer back-propagation neural network which also attempts to deal with other non-deterministic input, such as the Earning per Share value and a public confidence index.

Sermpins et al. [25] used a hybrid neural network optimization and adaptive radial basis function (ARBF-PSO) to implement a leverage negotiation strategy based on the Glosten, Jagannathan and Runkle (GJR) variability forecasts. By comparing the results of the ARBF-PSO with those of three different architectural neural networks, a neighbor neighborhood (k-NN) algorithm, a moving average model (MA) and a moving average convergence/deviation median (MACD) for the EUR/JPY, EUR/GBP and EUR/JPY exchange rates, for the period January 1999–March 2011 (daily closing prices from the ECB), the ARBF-PSO has been shown to be superior to other models in terms of statistical accuracy and transaction efficiency.

In our previous work, we designed and implemented an ANN, which tries to predict market signals in the money market [8] based on an input which consists of a series of econometric models (technical indicators). Essentially, the ANN “corrects” the econometric model, combining the advantages of technical analysis and ANN in causal modeling and case control. It is important to note that the ANN is not trained with a set of data and then tested with another data set but, rather, it is trained in real time and produces its price forecast in real time, being constantly trained throughout its life (at the resolution of one price per minute).

Although the aforementioned works do highlight the advantage of these novel architectures, compared to various previous models and to classic technical indices, they have not been applied to automatic trading systems. Thus, it is unclear whether their implementation can be translated to real market profits.

3 A detailed system description

In this section, we describe how we analyzed, designed and implemented an algorithmic ultra-short-term trading system, comprising all stages of the (price) negotiation process as described in [26]. This system includes the fundamental stages of Pretrade Analysis, Transaction Signal Production (Trend Forecasting), and Transaction Execution.

Our goal is to simulate the judgment of the human expert (technical analyst, broker) with an artificial intelligence system that responds in a timely manner to changes in market conditions making it possible to optimize the efficiency of short-term transactions.

First, at the analysis stage the data mining is carried out and the data used in the subsequent steps are selected.

Then, at the trend forecasting stage, a series of technical indicator simulators [6] were designed and implemented to generate the trend forecasting signal. Τhese signals are fed as inputs to the artificial neural network system (to be described in a subsequent section of this paper), which also yields a trend forecasting signal [27] with appropriate design changes in parameterization to be consistent with the attempted ultra-short-term trading.

At the transaction stage, a series of customizable high-frequency automated trading machines were designed and implemented, which receive as inputs the forecasting signals generated in the previous stage and perform real-time virtual transactions. Next, a comparative analysis of the results of both automated trading machines and each machine is made for the different sources of trend forecasting (the different technical indices and the ANN).

Finally, useful conclusions can be drawn about the suitability of different configurations of automated trading machines according to the trend forecasting source and about the suitability of the modified architecture [8] for ultra-short-term algorithmic trading.

3.1 Selection of the exchange rate and experimental data source

We have selected to experiment with the EUR/USD exchange rate, since this is the world's largest trading currency pair, and its market depth deters lobbies from engaging in price manipulations which might alter its true image.

Truefx [28], which is an industry leader exchange rate data server, and American Integral [29] were selected as the sources of experimental data. The largest institutional service FOREX providers in the world use the prices given by Integral.

We have experimented with the tick-to-tick EUR/USD exchange rate of July, August and September 2020. The data initially consists of over 10 million values, which after pre-processing in order to squeeze out flat areas (where the exchange rate does not change at all).

3.2 Technical analysis indicators simulators

Selecting the most suitable time frame is a decision which us unique to each individual trader. Normally, traders will focus on a time frame and then choose a time frame above and below it to complement the main time frame. So, they will normally use a long-term chart to define the trend, a intermediate-term chart to provide the trading signal and a short-term chart to select the entry and exit points [30]. On the other hand, Shynkevich et al. investigated the dependency of a financial forecasting system’s performance on the choice of a forecast horizon and of an input window length, which is a parameter used for calculation of many technical indicators. They used three well-established machine learning techniques, SVM, ANN and k-NN, and concluded that the highest performance was obtained when the input window length was approximately equal to the horizon [31].

After preliminary experimentation, we selected some technical indicators for our experiments [6], which are consistent with the short-term forecast (Fig. 1), namely the arithmetic moving averages (MAs) of 600, 900 and 1800 prices, the RSI-600 oscillator, the CCI-600 oscillator, the Williams-600 oscillator and the Price Oscillator (MA-600, MA-900, MA-1800).

Fig. 1
figure 1

An overview of the system—architecture

These technical indicators are calculated as described in "Appendix 1".

The system accepts exchange rate, time and date as inputs (Fig. 1) and, based on the predicted trend signal and the configurations of its auto-trading agents, simulates ultra-short-term trading and produces performance logs for simulating profit or loss. We are using the purchase price and the selling price as input to the accuracy of five decimal places, and we also use a tick-to-tick frequency [32]. (This is an upgrade over the four decimal places and the minute-frequency reported in [8].)

We use the purchase price for the stage of forecasting [27]. We can also use the selling price without a big different in our results. Both the purchase price and the selling price is used only at the automated trading stage.

The data serve as input to the technical indicator simulators (Fig. 1) [27].

The output of each technical indicator simulator is a value from the set of values in Table 1.

Table 1 Correspondence of arithmetical values to trends

The outputs of the simulators of the technical indicators are fed to the input neurons of the ANN system.

The prediction system consists of two series of ANNs, which operate in pairs. One ANN of a pair receives as inputs the outputs of the simulators of the corresponding technical indicators and works in conventional error back-propagation mode by trying to match the trend prediction. This ANN works with past values, so we can calculate the error in its prediction This ANN, then, transfers its learned weights to its pairing ANN, which, however, only works in feed-forward mode with present values. All feed-forward ANNs are then combined in an ensemble to produce the final trend forecast [27].

Technical indicators are generated and their predicted trends are sent to the input layer of each back-propagation ANN. A technical indicator corresponds to an ANN, and its calculation reflects its value at time t − M(x) − 1, where t − M(x) is the time in which the neural network with index x operates in the past. (For example, M(1) is 30 to indicate that we are interested in confirming the technical indicator’s prediction within 30 s; this also means that each ANN is trained on a time-point by time-point basis.) The hidden layer is activated by a tanh-type sigmoid to deliver output values in [− 2, + 2], while the output layer is linear. The number of hidden layer neurons was set to be 2 times the number of input layer neurons (based on preliminary results). The output layer neurons as well as the corresponding data export the trend signal for each back-propagation ANN (Fig. 1) [27].

Moreover, the algorithm of calculating the real trend is updated using the data from time points t − 1 and t − 1 − M(x) and the iteration is activated (Table 2). The real trend algorithm produces a normalized estimated value of the real trend. The output value of the final node is then compared to the real trend to train the neural network. The actual trend conditions of the actual ANN system forecasting trend signal (Table 2) are selected after preliminary experimentation. These conditions are in line with Take Profit Factory for trend signals (Table 6) [27].

Table 2 Actual trend conditions of the actual ANN system forecasting trend signal (the rules are listed in descending order of priority) which is consistent with ultra-short-term trading

Each back-propagation ANN in the series is characterized by the time in which it operates in the past (t − M(x)). The number of back-propagation ΑΝΝ is configurable. The number of feed-forward ANN is equal with the number of back-propagation ΑΝΝ. Each back-propagation ANN feeds the weights of its neurons into a feed-forward ANN [27].

Technical indicators are generated and their predicted trends (for the time t) are sent to the input layer of each feed-forward ANN. The hidden layer is activated by a tanh-type sigmoid to deliver output values in [− 2, + 2], while the output layer is linear. All the neuron weights are fed of the neuron weights of a back-propagation ANN [27].

Each forecasting trend (FT(x)) from the ANN feed-forward series leads to a linear equation calculating the final forecasting trend (FFT) of the system (Fig. 1).

$${\text{FFT}} = \mathop \sum \limits_{1}^{X} \left( {{\text{FT}}\left( x \right)*a\left( x \right)} \right),\;\;{\text{with}} \mathop \sum \limits_{1}^{X} a\left( x \right) = 1$$

where a(x) is the weight multiplier for each (x) feed-forward ANN.

The FFT is finally normalized to one of the values shown in Table 1 [27].

3.3 Design of the virtual transaction stage

This part includes a series of high-frequency automated trading mechanisms which perform virtual transactions with real data. It uses as input the forecasting from the previous level, the price of the exchange rate, and it manages a number of simulated transaction machines, each with a different configuration (to be presented below), producing for each of them a detailed log with all (simulated) performed transactions and obtained financial results.

3.3.1 Configuration of the high-frequency automated transaction machines

All input data (date, time, purchase price and sales price, as well as the trend forecasting of the technical indicators simulators and the technical neural network system) are fed to a series of high-frequency automated trading machines.


Automated trading machines only take into account the trend forecasting signals (− 1, + 1, − 1.5, + 1.5, − 2, + 2) to determine their strategy. Each trading machine is described using a set of parameters, as shown below:


1. Machine Class (0 or 1)

A Class "0" machine operates as follows: when it has a long (or short) position [32, 33] and receives a short (or long) predictive signal, closes the position without opening a new position. In other words, if it receives a forecasting signal opposite to an open position it closes the position. Note that if there is more than one open position then the opposite signal closes the earliest one (the one that has been opened before the other) while keeping the remaining positions open. In other words, a counter-forecasting signal closes only the earliest opposed open position and not all opposed open positions. This logic has been chosen so that any individual false predictive signals may not altogether close all opposing open positions leading to loss. Therefore, a balancing logic has been selected for each predictive signal received by the machine.


A Class “1” machine operates as follows: when it has a long (or short) position and it receives a short (or long) forecasting signal, it does not close the long (or short) position but, instead, opens a new short (or long) position. In other words, if the machine receives an opposite forecasting signal from an open position, it opens a new position (as long as the other machine parameters allow it) and manages both positions separately.


2. Sensitivity (1000–0)

This parameter refers to the sensitivity of each machine to open new positions when it receives short or long [32, 33] forecasting signals within a short time frame. The higher the value of the parameter, the lower the sensitivity of the machine to open new positions.


For example, if the sensitivity value is X and the machine accepts a long (or short) trend forecasting by opening the corresponding position, then an uninterrupted sequence of X new long (or short) trend forecasting values will not lead the machine to open a new position. In other words, two positions of the same (short or long) signal cannot be less than X data values apart.


3. Source of Trend Forecasting Signals (0–7)


Each machine has a single source of trend forecasting signals to open and close its positions. This source is defined based on the values of this parameter:

  1. 0.

    The machine receives trend forecasting values from the ANN system.

  2. 1.

    The machine receives trend forecasting values from the CCI oscillator.

  3. 2.

    The machine receives trend forecasting values from the long-term MA.

  4. 3.

    The machine receives trend forecasting values from the Williams oscillator.

  5. 4.

    The machine receives trend forecasting values from the medium-term MA.

  6. 5.

    The machine receives trend forecasting values from the oscillator.

  7. 6.

    The machine receives trend forecasting values from the short-term MA.

  8. 7.

    The machine receives trend forecasting values from the RSI oscillator.


4. Take Profit factor

The take profit factor allows a position to be closed automatically when the desired profit has been achieved. This parameter is defined by applying a multiplier (or divisor) to the position opening value for long (or short) positions.

For example, let us assume that the earnings factor for the ± 1 signal strengths of an automated trading machine is 1.006. Let us say we have an open long position with an opening value of 1.36110. If the exchange rate reaches or exceeds 1.36110 * 1.0006 = 1.36192 then the position will be closed.


It should be noted that the condition to close a position is ‘>=’ of the desired profit and not ‘=’ because in tick-to-tick frequency transactions price fluctuations can be larger than the minimum allowed price difference, especially in days with intense fluctuations (for example, the price can change from 1.36190 to 1.36196 without ever taking the value of 1.36192).


5. Stop Loss Factor

It is the maximum level of losses allowable for each position. This parameter is defined by applying a multiplier (or divisor) to the position opening value for short (or long) positions.


For example, let us assume that the maximum allowable losses coefficient of an automated trading machine is 1.0018. Let’s say we have an open long position with an opening value of 1.36110. If the exchange rate is equal to or less than 1.36110/1.0018 = 1.35865 then the position will be closed.


6. Take Profit Factor Revision Time


This is the time that the previously defined Take Profit Factor is revised. If an open position does not close within that time period, the Take Profit Factor is redefined since the prediction that led to the opening of the position has not been confirmed. The aim of this parameter is to close an open position even with limited profit or loss. This parameter is defined by a number of exchange rate values entered into the system after the opening of the specific position.


7. Revised Take Profit Factor

The Revised Take Profit Factor is activated and replaces the Take Profit Factor after the revision time as described in 6. The Revised Take Profit Factor may be even lower than one if its objective is to limit possible losses.


For example, let's assume that the desired Take Profit Factor for the ± 1 signals of an automated trading machine is 1.0006, the Revised Take Profit Factor is equal to 1 and the revision time is 1800. Suppose we have an open long position [32] at a market price of 1.36110. If after 1800 prices after opening the position the position is not closed, then the Take Profit Factor is revised to 1. Therefore, in order to close the position, it is sufficient that Selling Price >= 1.36110.


8. Maximum Waiting Time


This is the maximum length of a sequence of values for which any position is allowed to stay open.


9. Total Investment Capital


This is the total Investment Capital in USD for all period.


10. Investment Capital per Transaction


This is the Investment Capital per transaction in USD.


11. Maximum Leverage Ratio

This is the maximum Leverage Ratio. For example, a maximum leverage ratio of 1:30 means that an individual with a margin deposit of 10,000 USD can initiate a maximum leverage trading positions of up to 300,000 USD.

3.3.2 Operation and transaction logging of the high-frequency automated transaction machines

Automated trading machines display in real time the following data for each transaction.

  1. 1.

    The opening time of the transaction position with the accuracy of a second.

  2. 2.

    The opening price of the transaction position.

  3. 3.

    The Type of position (short or long) [32, 33]

  4. 4.

    The intensity of the trend forecasting signal (− 1, + 1, − 1.5, + 1.5, − 2, + 2) based on the opening of the position.

  5. 5.

    The time of closing the position with the accuracy of a second.

  6. 6.

    The closing price of the transaction position.

  7. 7.

    The profit or loss of the transaction.

It is worth noting that the opening of a long position [32, 33] takes place at the buying price and its closing at the selling price. Correspondingly, the opening of a short position [32, 33] takes place in the sale price and its closing at the buying price. In other words, the result of the ultra-short-term simulated algorithmic transactions include the spreads [1] between the buying and selling prices of the exchange rate.

3.4 System development and use

The system has been developed in Java using the NetBeans IDE 8.2.

The application is fully parameterizable by means of an appropriately labeled Type parameter file (.fxipf standing for FX Intelligence Parameter File), whose contents are shown in “Appendix 2”.

When launching the application, we select the parameter file and the main application screen {1} is displayed.

Figure 2 shows a desktop snapshot when executing the application. In the left side {2}, we view nine of the activated automated trading machines, while in the right-hand upper section we view the central simulation screen {1} and just below it we view the summary of aggregated results of automated trading machines {3}.

Fig. 2
figure 2

A snapshot of the simulation

The central simulation screen features the date, time, purchase price, sales price, spread of these two prices (which is the transaction provider's commission), CCI oscillator forecast, medium-term MA, the long-term MA, the Williams oscillator, the value oscillator, the short-term MA, the RSI oscillator, and the forecast of the ANN system.

The forecast is displaying at the bottom of the screen correspond to the values: [− 2: SHORT, − 1.5: SHORT, − 1: Short, − 0.5: Short, 0: NEUTRAL, + 0.5: Long, + 1: Long, + 1.5: LONG, + 2 LONG].

On the displays of automated trading machines, we see in real time the transactions and all their data and elements.

In addition to these screens, the aggregated results screen is also minimized. This screen consists of as many rows as automated trading machines. Each row displays the name of the machine and updates in real time the transactions, the profit or loss and the maximum theoretical profit that could have been achieved if the position had closed at the best possible time, within the maximum open position waiting time, as defined in the system configuration file.

At the end of the simulation, all transaction records are exported and stored in the data folder.

4 Experimentation and results

We have experimented with the tick-to-tick EUR/USD exchange rate of July, August and September 2020.

The values of the parameters selected for all neural networks (back-propagation series and feed-forward series) of the application are shown in Table 3.

Table 3 ANN parameterization

The selection of parameters from 1 to 7 was based on earlier work [8]. The choice of the 10-values ASM as well as the value 1 in the actual trend selection parameter was confirmed by preliminary experimentation. Limiting the number of epochs in ANN training to 10 may look as if we are imposing an unusually tight constraint, but it is a realistic trade-off between the need to provide training without spending too much time on it. (We remind the reader that we have set our system to be trained every second.)

The series of back-propagation and feed-forward ANNs consist of three ANNs each. We have also six parameters of each back-propagation ANN as shown in Table 4.

Table 4 Parameterization of back-propagation ANN’s

The parameter values selected for the technical analysis simulators are shown in Table 5.

Table 5 Parameterization of technical indicators simulators

The Price Oscillator period is based on three moving averages (line 7 in Table 5).

There are thirty-two (32) parameterized automated trading machines in the experimentation, evenly allocated to the ‘0’ class (opposite signals close each other's position) and ‘1’ class (opposite signals do not close each other's position). In class “1” machines, the maximum waiting time should be limited; otherwise, we are at risk of staying with several positions open at the end of the session. Half of the machines of each class (0 or 1) are of a higher sensitivity (value 1) and the other half of a lower sensitivity (value 10), giving rise to four combinations, overall, which are codified as machines of type I through IV (numbering in 1atin).

Based on the above, we group the machines into four general configurations (general machines or machine types) that we will now call general machines (or just machine Types). Each technical indicator simulator (there are seven altogether) and the forecasting machine of the ANN feeds a separate forecasting signal to a machine of each Type. Therefore, we activate 4 x (7 + 1) = 32 automated trading machines to simulate.

All values of the parameters of the thirty-two automated trading machines to be used in the context of experimentation are shown in Table 6. Theses parameters were selected after some preliminary experimentation with technical indicators to reflect a combination of real market conditions.

Table 6 Parameterization of automated transaction machines

Τhe typical leverage on forex trading institutions ranges from 50 to 400 times [1].

In our experimentation, we choose the minimum leverage ratio for our transactions, so as to minimize the risk of capital loss. We note that the maximum leverage ratio occurs rarely within the experimental period. Since we experiment with more than one open position at any time, we exploit leverage by allowing multiple open positions (instead of just one position with a much larger value; however, positions do not open simultaneously, but may overlap temporally). In the case of machines with general type I and II, the maximum number of open positions is 30 while in the case of machines with general type III and IV it is 5. In all cases, the invested capital per transaction is $ 10,000. That is, we do not use leverage for each transaction separately.

4.1 Presentation and analysis of results

We note that the below take into account spread between purchase and sell price so the transaction cost is included on our calculations.

We notice that the best performance in absolute profit ($ 9032) is achieved by the Type I machine which uses the ANN as a source of forecasting, followed by the Type II machine, again with the ANN as a forecasting source ($ 8506) (Fig. 3).

Fig. 3
figure 3

Total experimental results per machine and forecasting trend source in descending order

Among the top four, we observe the Type III and Type IV machines with the ANN as forecasting source.

It is noteworthy that the first places in terms of performance are occupied by the ANN. All the others forecasting sources fare quite badly. We notice that all machines with oscillators as a forecasting source lost all of the investment capital.

In general, we observe that Type I and II machines (sensitivity parameter set to 1) with ANN are superior to the corresponding Type III and IV machines (sensitivity parameter set to 10). This is to be expected, since machines I and II have a maximum leverage ratio of 6 times compared to machines II and III. Moreover, we observe that type 0 machines perform slightly better than type 1 machines.

In terms of average earnings per transaction, the best performance is achieved by the Type IΙΙ machine with ANN ($ 0.193 per transaction), followed by the Type IV machine with ΑΝΝ ($ 0.181 per transaction) (Fig. 4).

Fig. 4
figure 4

Total monthly experimental results per transaction per machine and forecasting trend source in descending order

The last entries to the top four are the Type I machine with ANN, the Type II machine with ΑΝΝ.

We notice that all machines with any other technical indicator have loses.

In general, we notice that Type III machines (machine class 0 and low leverage) outperform in terms of average profit per transaction.

Type IΙΙ and IV machine with ANN predictor are profitable for the largest number of days within the total period of experimentation (49/78) (Fig. 5).

Fig. 5
figure 5

Days with profit per machine in descending order

Figure 6 shows the total profit per forecasting source for all machines, in total pips and at average profit per transaction. ANN turns out to be the most efficient with $ 20,728. All the technical indicators underperform and lost the entire investment capital.

Fig. 6
figure 6

Total profit per forecasting source in all machines (total pips vs. average profit per transaction)

In terms of average profits, the ANN ($ 0.17/transaction) outperform the profit of all others in absolute figures.

Figure 7 shows the total profit per machine Type and the average profit per transaction for the ANN forecasting source.

Fig. 7
figure 7

Total profit per machine type (total pips vs. average profit per transaction)

The most efficient generic machine Type appears to be of Type I ($ 9032) followed by Type II ($ 8506). This was to be expected, since the I and II engines have the highest sensitivity (using the highest leverage). If we take into account the earnings per transaction (which are independent of the leverage since each transaction has invested the same initial capital, i.e., $ 10,000), we notice that the most efficient is the general type III machine (Low leverage and class 0). Among the high leverage machines (type I and II machines), the type I machine (general type 0) is more efficient.

Figure 8 shows the comparative daily yields of the four general Types of automated trading machines. We notice that machines with the highest sensitivity (I and II) are more prone to lose heavily but also to profit strongly. Also, among machines of the same sensitivity (I and II or III and IV), we notice that class "1" machines (as described in paragraph 3.3.1) are, also, more prone to such gaps in performance compared to class "0" ones. Therefore, in terms of decreasing tendency to register large profits but also large losses, we could rank the machines as follows: II > I > IV > III. By calculating the standard deviation of daily/period returns, we see that this rank has not been disturbed by considering a risk-adjusted measure.

Fig. 8
figure 8

Comparative daily yields ($) and standard deviation of the four general types of automated trading machines

“Appendix 2” features the detailed results of the experimentation per day, machine and source of forecasting.

If we focus on ANN-based machines, the most efficient with the fewest loss-making days is the Type III machine. We also note that loss-making days appear more often in the early days of the period of the experimentation. This observation, which is confined to ANN-based machines, suggests that as an ANN is trained over time, it improves the quality of its forecasting.

Figure 9 shows the cumulative profit for each general machine Type and the forecasting signal of ANN. Regarding the generic machine I and II, the sequence of ANN cumulative profitability has been increasing throughout the period of the experimentation, and particularly so in the second half of it, apparently due to improved network training.

Fig. 9
figure 9

The comparator sequences for each general machine type in relation to the source of the forecasting trend signal

The ANN in the general type IV machine behaves identically to the Type III machine.

Figure 10 shows the comparative monthly profit percentages of the four general types of ATMs based on the ANN forecast.

Fig. 10
figure 10

Percentage gain in investment capital

As expected, machines with high sensitivity (high leverage) show higher percentage monthly profits. A back-of-the-envelope comparison between all machines involves some leverage balancing, i.e., an × 6 multiplication of leverage per transaction for the 1:5 machines (to map them to a 1:30 leverage) and suggests that lower sensitivity machines are overall more efficient (Fig. 11).

Fig. 11
figure 11

Percentage gain in investment capital with balancing leverage

In the case of leverage balancing, the maximum invested capital leverage between the 4 machines is the same.

4.2 A brief discussion of the results

Reviewing the results above, we can attempt to draw conclusions on a number of important topics.

On selecting the most suitable combination of machine (Type) and forecasting source, with reference to the percentage of profit in investment capital with balancing leverage, a Type III machine with ANN prevails, followed by (in that order) Type IV with ANN, Type II with ANN and Type I with ANN.

On selecting the most profitable forecasting source regardless of machine Type, we clearly observe the superiority of the ANN, where machines with all other forecasting sources lost all the investment capital.

On selecting the most profitable forecasting source regardless of predictive source, after balancing the leverage, we note the relative superiority of a Type III one followed by a Type IV one. So, it seems that if we do not consider the source of the prediction signal, generic type machines with the lowest sensitivity seem to be more profitable. We have also noticed (see Fig. 8) that high sensitivity machines (I and II) are associated both with higher losses and higher profits and that between machines of the same sensitivity (I and II or III and IV), we observe that machines of class "1" are more unstable than those of "0" class. So, in terms of decreasing instability one would rank machines as follows: III > IV > I > II. Additionally, we observe that, in general, machines which are less unstable (to high profits and high losses) are more profitable regardless of the source of forecasting; as a result, using low sensitivity machines (of Types III, IV) should be preferred, if we are uncertain of the forecasting source.

On associating efficient machine Types with forecasting sources, we have observed that the high sensitivity machines (Types I and II) are better suited to most effective sources of forecasting. Specifically, a Type I or II machine is better suited to ANN forecasting. On ultra-short-term transactions, the high sensitivity is a desirable feature (i.e., being able to quickly open and close positions) if it is accompanied by high profitability, as this reduces margin and leverage, which is otherwise great due to the nature of these transactions. By limiting leverage, we reduce the likelihood of automatic liquidation of our positions (by the broker, in cases where the specified margins have been exceeded).

If we attempt a comparative discussion of the forecasting sources, we have experimented with, as regards their apparent suitability for use in ultra-short-term transactions in FOREX, we note that the ANN system had the best overall performance, but it also surpassed all other sources on all machines. Based on the analysis of daily earnings per machine and the examination of comparative profit aggregates, for each Type of machine, it appears that, over time, the ANN system can be effectively trained to improve the quality of the forecast. All other indicators led to the loss of all invested capital.

5 Conclusions

We have designed and built a tick-to-tick ultra-short-term trading system, which includes all stages of the trading process, namely pretrade analysis, production of the transaction mark (trend prediction) and execution of transactions, for ultra-short-term transactions in the FOREX market. The system is fully customizable and has been built using a lean object-oriented approach. This has allowed us to simultaneously test a large number of automated trading machines, which, in turn, drew predictive data from a series of technical indicator simulators, as well as from a neural network system attempting to online learn how to correctly forecast a new technical indicator. The dataset consisted of over 10 million data points, and we have fed it through a set of 32 automated trading machines, each one featuring a different combination of forecasting signal source and trading parameters.

Based on the results of our extensive experimentation, we have concluded that, for a large collection of appropriately set parameters, the implemented algorithmic trading system performs fully autonomously at a (simulated) profit when tested with real data.

More aggressive (more sensitive) automated trading machines for opening new positions seem to be better suited to using reliable forecasting signals (such as the ANN introduced in this paper). If the forecasting signal is of lower quality, one would be better off with less sensitive machines.

Future work should focus on examining alternative ANN training techniques as well as investigating the exploitation of conventional fundamentals, break events and news which affect the FOREX market and might be announced at any time point during a 24-h day. Such data can be harnessed from the internet in real time. Also, different neural networks models, with various input data set combinations (such as the technical indicators) will be considered and compared.

Additionally, it would be extremely interesting if we could build a closed system of virtual transactions, which would also simulate the trade-based setting of the exchange rate (as opposed to retrieving it from an online source). The objective of such an experimentation (which, undoubtedly, would have to be properly designed and computationally budgeted for) would be to examine the relative quality of the auto-trading machines, if they are all based on the same quality forecasting source (the ANN, for example), and their ability to evolve their ability to counter quality trading opponents, over time.

It is evident that by opening up our implementation and our research in such a way, one expects that we can pursue research at a variety of levels: We can investigate how one produces industrial-quality trend prediction, while also researching how one can utilize such trend predictions, either for profit-making enterprises or as a tool for tilting a market towards an equilibrium for hedging purposes.