Testing the Stochastic Expert Advisor

Testing the Stochastic Expert Advisor

Views: 45  
Reading time: 4 min

Today, we are getting acquainted with another robot based on the signals of a standard mathematical indicator. The Stochastic expert advisor is an algorithm that uses overbought and oversold areas of the indicator with the same name; however, it has an original touch.

What is the Stochastic?

I presume everyone knows such a popular oscillator as the Stochastic. It is featured in a standard set of indicators, almost in all popular trading terminals including MetaTrader 4, MetaTrader 5, and R Trader. The indicator was created by George Lane who noticed certain patterns in growing and falling markets. In more detail. Read about the Stochastic Oscillator below.

The indicator is based on overbought and oversold areas that give trading signals.

The Stochastic is an oscillator: this group differs from other indicators in the sense that they react to price changes in the market very fast. However, the speed of reaction depends on the settings of oscillators, any of them may be set up to give much rarer signals.

How the Stochastic expert advisor works

How the Stochastic expert advisor works

Describing the oscillator, I mentioned the overbought and oversold areas; however, the expert advisor does not use them. Instead, the robot uses the direction of the indicator line: analyzing it for the current moment, it defines the direction of trading. After you open a trade, place firm Stop Loss and Take Profit levels; then things will depend on the market solely.

When I started describing the robot, I mentioned that it is written in an original style. In fact, this is not some style in programming – this is the principle of receiving a trading signal that presumes analyzing several timeframes and opening the next trade (and placing an SL and TP) only if the direction of the Stochastic lines on all timeframes coincide.

Technically, the direction of the indicator lines is defined not by measuring the values of the lines related to previous values but by the position of the Stochastic main line related to its signal line. If the signal line is below the main one, it signals to buy; if it is above the main one, it signals to sell.

This method has its drawbacks as in the overbought and oversold areas, these lines often cross, giving false signals in unsuitable moments.

The expert advisor analyzes only three timeframes: M5, M15, M30 (intraday timeframes). Better choose one of these three when choosing a period for optimizing/ trading.

If you know the MQL programming language a bit, you may easily edit the code of the Stochastic expert advisor if you are craving to bring the parameters to perfection.

Technical characteristics of the Stochastic expert advisor

Technical characteristics of the Stochastic expert advisor

The expert advisor is meant for M5 and M15 timeframes and any currency pair; however, some manage to use the robot on hourly timeframes even. Also, if you manage to optimize it, try using the Stochastic on minute timeframes: in some cases, the expert advisor shows the best results on M1.

The best pair would be EUR/USD; however, according to the tests by other traders, the Stochastic demonstrates great results with other pairs as well.

If you SLs, TPs, and lot are minimal, 100 USD will suffice for trading with this robot.

Parameters of the expert advisor

  • TP is the Take Profit in points
  • SL is the Stop Loss in points
  • Lots is the size of the lot
  • Shift is the shift of the signal line related to the main one, in bars.

Optimizing the parameters, mind that the Shift must not be zero, otherwise, the expert advisor will open no trades at all.

Optimizing the Stochastic

I did not check the code of the expert advisor before optimizing the parameters and used M30; however, I presume that M5 will be better.

I added an archive with my parameters to this article, find it attached at the end.

For optimizing, I only chose the parameters of the SL and TP. Here are the results that the expert advisor demonstrated after the optimization:

The results of Stochastic EA test drive
The results of Stochastic EA test drive

They are far from perfect but during more than half a year the trades were rather scarce; provided that your money management is consistent, you will save your deposit almost for sure.

Using the expert advisor in trading

To use the expert advisor in trading, at least on a demo account, first, choose optimum parameters with the help of MetaTrader 4.

To optimize it completely, edit the code or better paste the optimization parameters of the indicator into the setting window of the expert advisor to optimize them automatically.

After the optimization, you will have several sets of parameters anyway that will give good results on backtesting. I recommend using several sets for several copies of the expert advisor on different deposits.


Regardless of the Stochastic expert advisor being one of the simplest robots based on simple indicators, it optimizes well even without aggressive trading methods such as a grid of orders or Martingale. So, you may use a bunch of these robots of different indicators to minimize risks.

Download Stochastic Expert Advisor


Previous article

Paid Subscription on Twitter: Investors Buying the Stocks

Today, I will speak about Twitter stocks (NYSE: TWTR). Twitter earns about 84% of its money on advertising...

Next article

How to Trade Nikkei 225 Index?

Nikkei 225 is one of the most important stock indices reflecting the state of the Japanese economy and overall business activity in the country.