In last month's article was presented the strategy of the Maximums and Minimums [1]. This strategy makes sense in pairs of low volatility, such as EUR/CHF. Although the automation trading has got some well known advantages. This article presents an implementation of the strategy using the JForex language.


A JForex strategy is essentially composed of three parts. The first one is the part of the parameters and strategy settings. The second one is the part containing the logic of the strategy (interpretation of indicators) applied to the bars, ticks or both.
Finally the third is a logistics part where we have the functions that allows us to launch and control orders to the market.
In this article, as you can see in the following chapter the focus will be on the first and second part. The following topics are the most important aspects that are implemented in the second part of the strategy.

The Jforex Strategy

You can see the full strategy description on last month’ article at [1].

1. The entry market triggers

“On each closure of the one hour candles, the basic idea is to check if the Close occurs above or below the maximum or minimum of the previous day relatively, then we must analyze whether the price closed also outside Bollinger Bands with default values (20, 2.2).

If these two conditions are fulfilled, two distinct orders are open at the market price, ....”

This Block represents the trigger when the one hour candle closes above the Last Day Max and out Bollinger Bands Max. Then if there are no open orders, 2 opposite orders are opened.

This Block represents the trigger when the one hour candle closes bellow the Last Day Min and out Bollinger Bands Min. Then if there are no open orders, 2 opposite orders are opened.

2. The Martingale

“Once one of the orders reaches the take profit, the second phase of the strategy is initiated, to try close the order that was open only with a residual income. If it does not go to TP soon, a spaced Martingale of 35 pips began for over 3 levels, ie we will add 3 more orders at most to our initial order that was open….”

This block represents the implementation of the martingale[3] according the number of levels defined in the parameters and choose the side to open orders related to the open order.

3. The Taking Profit

“From the moment we have more than one open order in the same direction, we do not to use a fixed take profit, and instead the strategy will calculate the residual value that was set and so this is reached all open orders will be closed, starting a new cycle….”

This Block represents the implementation of Taking Profit according to profit in USD defined in the parameters, once the value is reached, all opened orders are closed.

4. The auxiliary strategy graphic lines

The strategy has an set of two auxiliary graphic lines to help us identify visually the MAX and MIN of last Day, for visual proposes only.

This Block represents the implementation of some pre-defined objects like IHORIZONTALLINECHARTOBJECT to draw horizontal lines at Last Day MAX and MIN.


Another important implementation are the parameters that we can configure at the begin of the strategy.

In this image I present all possible configurations that can be set, as you can see the strategy give us the possibility to make a lot of combinations to try the best results. I think you can identify easily each one of these parameters, but give especial attention to Start Amount, Amount Increment, Grid Levels and Levels Space in Pips, these are for Martingale proposes.

6. The Simulation Results

For the simulation, I performed a back test strategy for the 2nd half of 2016 with the initial amount was $ 10,000.
The results were very encouraging, with superior performance to 34%. In the following images we can see the results and orders obtained from the simulation.

This image show the equity evolution during the backtest performed.

This image contains the summary of the Profit, Turnover and the Parameter' values to achieve the final result.

This summarizes the operations performed.

This image contains an example of a list of some orders that the strategy launched in the 2nd half 2016.


An automated strategy has several advantages over manual trading. In this paper I presented a possible implementation of Maximums and Minimums strategy.
The strategy presented good results when applied to the 2nd half of 2016.
As mentioned in the previous article [1] for the proper functioning of this strategy should be avoided periods of high volatility arising from scheduled news (eg Brexit [2]).
The trader can change some of its parameters, thus building a different setting strategy and try to get even better results.
As future work in the next article will be an implementation in Visual JForex of this strategy.


[2] https://www.forexcrunch.com/brexit-impact-forex-infographic/
[3] http://www.profitf.com/articles/trading-methods/martingale-trading-method/
Translate to English Show original