Price Action Trading Strategy Optimization With Smart Forex Strategy Tester

THIS PAGE IS DEPRECATED!
The example is based on the old software. We are porting it to the new platform.
Subscribe to download the latest Smart Forex Tester software and be notified when the strategy is ported.

Here we will present an example of optimizing the sample price action trading strategy that is supplied with Smart Forex Strategy Tester. You can download the latest software and try all this for yourself.

On the screenshot below, you can see the test results for the sample strategy from the download bundle (machine4.stg).  It is so called price action trading strategy – i.e. not using any indicators, just the price pattern. To enter the market, the strategy uses the pivot points detection algorithm which identifies turning points in real time.

The market data we used is also included in the download bundle (week26.db). For this example, we just cut a small fragment (week26_1.db) from the very beginning of the data file: about 1.5 hours of trading time (just shy of 1800 ticks).

price action trading strategy base
Price action trading strategy – baseline

 

In the base strategy, take profit and stop losses are made static: 5 pips each. Note that the price graph shows ASK quotes. This is done for easier reading. When you will be repeating the tests, you can plot any quote you want, of course. Or all of them if you see fit.

We see that first trade was a Sell. The algorithm placed the order quite well. And the position quickly became profitable. But the profit was taken rather quickly – the profit potential has not been fully used.

The same holds true for the next trade which was a Buy. Market entry was just perfect. But the profit has been again taken far too early.

The third trade was a loser. Even though the market entry was not ideal, it was good enough. The position again quickly became profitable. But the profit didn’t reach the static threshold by the time when the market changed direction. And eventually the stop loss was triggered.

So all 3 first trades show how inefficient a static profit taking can be.  Next, we will try to optimize it using enhanced profit taking logic logic.

Smart Forex Strategy Tester uses state machines for strategy definition. In the base strategy the profit is taken immediately after the position reaches some predefined level of profit (set by the minprofit in the beginning of the stretegy definition file).

This is implemented by the following logic in the state machine (example for a long position):

## LONG PROFITABLE
state.long profitable=new tick->taking profit long

This means that if the state machine is in the state “long profitable” and it receives the event “new tick”, the machine will switch to the state “taking profit long” and closes the open BUY order.

The same logic is of course implemented for the short positions.

Price Action Trading Strategy Optimized: Let Profits Run

It is clear that the biggest improvement we can achieve if we can postpone profit taking for the big market advances. It is often called “let profits run”. As such advances happen between turning points, we can try reusing our algorithm for market entry.

So let’s now change our profit taking logic as follows: when the trade becomes profitable, let’s wait for a market pivot point in the opposite direction. E.g. if we have a long position, let’s wait for the market top.

To optimize the strategy for more flexible profit taking, we can make the following change in the state machine (example for long position, same logic for short):

## LONG PROFITABLE
state.long profitable=max slow filter->taking profit long

Here we are not taking profit immediately on the next tick but are waiting for the signal from so called “slow filter”. We use this filter to smoothen the jitter of the real-time quotes and so avoid false signals.

Price action trading strategy optimization
Price action trading strategy optimization with flexible take profit algorithm

The graph above shows the test results with the optimized state machine. We can easily see the difference. Overall profit has doubled. But for now, we are more interested in the details of how our enhanced profit taking was working. Let’s see.

For the firts two trades, the profit potential is used very well; almost fully for the first trade. For the second trade the improvement is also clear, though you can see that due to the small delay imposed by the filter, we missed the very top.

For the 3rd trade profit taking is flawlesss, as well and the trade was a winner. But you may note that market entry was done in the different direction than before. Did the optimization help to make a loser profitable? Yes and no.

The state machine in current version can only handle one trade at a time. So with optimization, market entry for the 3rd trade happened later, as we were waiting longer to take the profit of the 2nd trade. And it helped. But of course, it could have been the other way round.

The 4th and 5th trades are losers regardless of the profit taking method. But here we have a different problem. This simple strategy does not have any logic to recognize a trend and follow it. In the next posts, we will discuss optimization ideas for price action trading strategy for trending market.

Download the latest version of the Smart Forex Strategy Tester and try optimizing yourself. If you have some ideas you would like to try – let us know!

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.