What is Walk Forward optimization in Forex trading?


Walk Forward is Forex trading is an innovative method to find robust strategies for trading.

My name is Petko Aleksandrov, and I have decided to write an article about the recent update we have in EA Studio for the Walk Forward and especially for the Walk Forward optimization. And I have just created some remarkable strategies for trading using the Walk Foreward tool, and I want to share my experience with it.

And for the beginner traders, EA Studio is a strategy builder that we use on our website, which allows the traders to automate their trading without any experience in programming. There are Free videos about how to use it.

Let’s take any trading strategy as an example and use the currency pair GBPJPY on M15. And I will explain to you first what is the update in the optimizer.

If I just run the optimizer in EA Studio without changing anything, there will be two different balance charts or two equity lines. One is with the old strategy or with the initial strategy, which is the grey color line. And the new one, normally higher, shows the strategy results after the optimization. When you do that, you can see the numbers of strategies, but they are not going into the collection.

If you want to use the optimized strategy, press the green Edit button. You will see something very similar to in the Walk Forward.

After the optimizer is ready, we will see the new inputs of the indicators. And we will see the difference between the new strategy or the optimized strategy, and the initial strategy. And this is very nice because we can see the difference. We can also decide if we want to use it or we don’t want to use it.

Now because I have selected to use a step of one during the optimization probably, this will go to an over-optimized strategy. A good indication of that is if you see a really nice equity line for the new strategy.

When you are ready with the optimization, you can select if you want to use the optimized parameters on not. If you’re going to use them, press the Green button Edit. If you do not wish to use them, go back to the editor, and you will see the initial strategy.  So this is the update in the optimizer, and now let’s go to the Walk Forward.

Walk Forward optimization updated
The Optimizer in EA Studio

Walk Forward: 30% Out of Sample means 70% of the strategy will be optimized, and the rest will be tested as real trading

What the Walk Forward does, it divides the whole backtested period into different segments. By default, it divides the period into five segments, and if I click on Start, it starts to optimize the strategy for the 70% of the first period, and this is if you have selected to use 30% Out of Sample. Then it will simulate trading for the rest 30% of the first segment.

And when it is ready, it will start the new optimization so that it will be from the beginning of the second purple line until the end of it, and then it will perform trading, or it will simulate trading for the next zone. This is how Walk Forward works. I have explained it in more detail in the course Top 10 USDCAD Expert Advisors.

And this process repeats till the end. It optimizes for the period, and then it simulates trading for the next zone or the next segment. And after that, we see the results with the new parameters. Now, what is the update with the Walk Forward?

The update with the Walk Forward is very visual, and it makes it even better.

When you go the parameters of the strategy, you can see that now the parameters of the different segments are available. Something that was not visual, and we didn’t see before what are the settings. Now we see here the original parameters of the strategy, and then after the first optimization, we see the parameters of the segment.

If it is a smaller number we see it in red, and if it is a bigger number we see it in green. If it is equal again, it is in green, but let’s say we have envelopes period of 38, and it changes to 52, you will be able to see it in green. But after the next optimization, it can go down to 35, and you will see it in red.

Now with the Walk Forward optimization, we have very visually how the parameters change for each segment. Then on the right side, we have the Out of Sample Net profit where we see the original strategy, how it performed in the different segments, and after the optimization, what is the result. This way we can see that in the first segment it made a worse result, for example, with the second one it could be better.

We have a better strategy if the new strategy with recent parameters shows better results.

We have a full backtest with the last parameters. In grey color, we see the initial strategy, and in the end, when the Walk Forward is ready, it will perform a backtest with the last parameters, and this is the critical point here.

Full backtest with the strategy
The parameters in Walk Forward are visual.

After the optimization is ready using the Out of Sample, with the last parameters, we can see if the result is better or not? The final parameters are the parameters from the last segment, but the complete backtest is done over all the Historical data we have.

We can see the new equity line compared to the original backtest. And what is the idea here? Very simply, if the new strategy with the recent parameters shows better results, we have a better strategy.

I am having filtered Acceptance criteria.

Another update that we recently had is the possibility to filter the strategies with the Out of Sample of the Acceptance criteria. This means that we can select what criteria to have in the Out of Sample and in the In Sample. For example, let’s use a 1.1 Profit factor for the complete backtest, alright?

Also, let’s say we want to have 1.1 Profit factor for the In Sample part and the Out of Sample part. We can filter the strategies when we use the Walk Forward optimization in the Reactor.

From the validation, you can set what criteria to use.

Sometimes you will see all of the parameters changed during the Walk Forward, and if you see that only the Stop Loss and Take Profit were not changed, it means that they were not selected from the Settings.

There will be strategies where the Walk Forward makes worse profit. If it is much below the equity line of the original strategy, this gives us the sign that the initial strategy might be over-optimized.

And from validation, you can set what to be the criteria. And I usually use $10 as a minimum, so I want to see strategies with a tiny profit, or let’s say I want to see the positive strategies and not the negative strategies. So to summarize it one more time, after the Walk Forward is ready, it takes the last parameters from the previous segment, and it performs a complete backtest.

Validation of Walk Forward.

  • It compares the complete backtest with the original strategy
  • if the common Acceptance criteria were validated for the backtest with the last parameters
  • do we have a better strategy or not?

Anyway, you can sometimes see the outcome of each segment to be positive but it’s not validated as well because, in Validation, we need to see minimum $10 of a profit and if in any of the segments we have $2, or we have $3, it will be still below that $10:

The validation in Walk Forward
The validation is quite important

And now, to compare it with the equity chart of the different segments, you can see in the Walk Forward if it succeeds in making a better equity line. But this is the result of the Walk Forward when it’s optimizing one segment, testing the strategy for the next one, then adding the data and testing it until the end. And if you get a better strategy, this gives you a sign that the strategy is not over-optimized.

But in parameters, we see that with the last inputs of the indicators, the strategy made worse results than the original strategy. So in order to say that the strategy was validated, we want to see a better strategy than the original one. Also, the common Acceptance criteria to be validated, and in this case, it’s not validated, and at the same time, we want to see all segments validated.

A better strategy makes more profits than the initial one.

In the Out of Sample Net Profit table, there are green boxes that mean they are positive, but according to the validation, they could not be validated because I requested a minimum of $10 of a profit. These are the criteria for validation of the segment Out of Sample part. Alright? And if you check that on different strategies you will see what the difference is.

In the picture below, you can see a different strategy where I want to show what is the difference with the Walk Forward with different strategies. You see is that the Walk Forward failed to show a better strategy when it went through the different segments.

But you can see that in full backtest validation, we have a better strategy. Is strategy better; yes. This is because if I go to parameters in the full backtest with the last parameters, we have a strategy with more profit. OK?

A better strategy makes more profits than the initial one.
Equity chart.

Successful strategy validation.

So the Walk Forward takes the last parameters from the last segment. After that, it performs a backtest for the entire period for the whole historical data, and it shows the results. And sometimes you will see strategies on profit in the Out of Sample, better than the initial strategy.

With the Walk Forward, we have the same strategy but with better parameters. And it’s up to you if you want to use this strategy. EA Studio will now allow you to use the new parameters if the Edit button is not in green.

The strategy is validated, or the Walk Forward validation or the Walk Forward optimization was successful when:

  • All segments to be validated.
  • second is to have the whole backtest with the last parameters to be verified with the Acceptance criteria
  • better trading strategy than the original one

What I see from the statistic is that we have a Profit factor 1.71 with the original strategy. And then we have after optimization 1.09, which is less than 1.1, which is what I have selected in the Acceptance criteria. As well, the second segment is not validated.

It has only $9, and I want to have a minimum of $10.

Walk Forward is included now in the reactor so that you can use it.

But I have tested it already, and I can tell you that it is tough to get strategies.

But this is the idea, and it filters the strategies very well because it uses many things. So, for example, in the generator settings, if you use Out of Sample, it will run the generator with Out of Sample. It will pass the strategies down according to the Acceptance criteria, they will go to the Walk Forward optimization, and there you can choose what Out of Sample to use.

You can use the same one. You can use it if you want to fulfill the Acceptance criteria, and you can use the segments. And I can tell you that I have run reactors for a couple of hours. I get just two, three strategies at the end of the day.

And this is great because it filters the strategies a lot. This way, they go one time through the Out of Sample with the generator, then they are screened with the common Acceptance criteria. Then they will go to the Walk Forward, where it does Out of Sample for the different segments. It backtests with Out of Sample for the parameters of the last segments. If the three things are satisfied, which I have said, then it will go to the Monte Carlo.

Walk Forward.
The Reactor.

What is the difference between Walk Forward optimization and the Walk Forward validation?

What is the difference between the Walk Forward optimization and the Walk Forward validation? The Walk Forward validation validates the strategies. So if you want to verify the strategy that is coming from the generator, you can validate it with the Walk Forward or with the Monte Carlo. But they don’t change the strategy.

They don’t change the parameters of the strategy. And if you want to use the Walk Forward optimization, then it will change the strategy with the last settings from the last segment. And if you validate the strategy it will proceed further.

So it is up to you how you want to use it. And here, we have Full Data optimization, which is the regular optimizer that we had so far. Full Data is the name to make clear that this is an optimizer using the complete historical data. And with the Walk Forward, we use different segments.

Use one of the three, not all of them.

And the best thing is to use one of the three. No need to use the Full Data optimization, the Walk Forward optimization, and the Walk Forward validation. From the tests that I did so far to use the Walk Forward optimization. Of course, I will test it more. And if I have something new to share with you, I will do that.

I will appreciate if you share your opinion on the FORUM. Don’t hesitate to drop some pictures, ask questions. But so far, what I saw, it just gives better strategies at the end of the day when it uses the last parameters. It validates, it uses the Out of Sample at the same time for the segments and the complete backtest. And when we use it in the reactor, we filter a lot of strategies until they come into the collection.

If you have not yet tested EA Studio with a 15-day free trial, you are welcome to do that

Cheers.