forex software

Create and Test Forex Strategies

forex software

fsb:manual:interpolation_methods

Interpolation Methods

Following a fixed route, Forex Strategy Builder goes round each bar in order to execute or cancel all orders sent by the strategy. This route is determined by the four base points - Open Price, High Price, Low Price and Close Price. In most cases, this information is sufficient for a correct calculation of the historical test. If the strategy sends close orders, however, and they are within the limits of the current bar, it is not always possible to determine for sure what the order of order execution is.

Those bars for which we cannot tell for sure the correct sequence of order execution, are called Ambiguous Bars.

Forex Strategy Builder provides various interpolation methods for calculating the back test. Each one of these methods interpolates the ambiguous bars in a specific way. If the strategy contains a large number of ambiguous bars, the end balance of your virtual bank account can vary significantly with the different methods.

Pessimistic

With this method, FSB aims at executing the order which will bring about a more negative result.

Examples:

  • If we have a long position open with two active close orders - Take Profit and Stop Loss, the program will execute the Stop Loss order.
  • If we have an open position with an exit order which will close it at a profit, instead of closing it, FSB will transfer the position to the next bar. Closing the position within the current bar will make profit, while transferring it to the next bar makes this less certain. This logic sometimes leads to closing the position at a greater profit. Therefore, the Pessimistic method does not guarantee the worst possible result with all forex strategies.

Shortest

The Shortest method goes round each bar, following a fixed route, depending on whether the bar is rising or falling;

  • The price route for a rising bar is Open, Low, High and Close;
  • For a falling bar it is Open, High, Low and Close.

These are the shortest possible routes through the bars, which is how the method gets its name. With them, the price never goes back to a previous value.

The Shortest method imitates the development of a maximally effective market. The chosen order of going through the key points is valid for 90% of the bars.

This method, however, has a major flaw. Because the price moves in a single direction through the margin points, if we have two valid orders in most of the bars, this leads to major distortion of strategy result.

Example:

  • If we have an entry order with Take Profit and Stop Loss orders within the limits of a bar, FSB will continue in the same direction after the entry order has been executed. This will lead to always executing the Take Profit order. In a situation like that, the Shortest method will bring about a highly exaggerated result. In some cases the result will be better than the one produced by the Optimistic method.

Because of the extreme results this method brings about, it can serve as a good basis for comparison with the other methods.

Nearest

With this method, Forex Strategy Builder will execute the nearest of all active orders in the current bar.

Example:

  • If there are two entry orders at the lower and at the upper Bollinger Bands, the program will execute the order which is nearer to the Open Price of the bar.
  • If there are Take Profit and Stop Loss exit orders, the nearer one will always take precedence and be executed. This will lead to highly exaggerated results in one direction or the other, depending on how near the respective order is.

Optimistic

This method's logic is opposite to the logic of the Pessimistic method. Forex Strategy Builder aims at executing the order which will bring about a higher profit.

Examples:

  • If we have a long position open with two active close orders - Take Profit and Stop Loss, the program will execute the Take Profit order.
  • If we have an open position with an exit order which will close it at a loss, instead of closing it, FSB will transfer the position to the next bar. Closing the position within the current bar will make a loss, while transferring it to the next bar makes this less certain. This logic sometimes leads to closing the position at a greater loss. Therefore, the Optimistic method does not guarantee the best possible result with all forex strategies.

Random

With this method, Forex Strategy Builder executes orders in a random sequence. The statistical probability that a given order be executed is inversely proportional to the distance to it. The nearer order is more likely to be executed than the further one.

Method Comparator

If the backtest shows ambiguous bars, you may use the Method Comparator in order to compare the result of calculations of all the methods you want. The comparator plots all balance lines on a single chart as well as a mean balance line making easier their visual comparison.

Method Comparator

We can see on the above chart that the “Shortest” method shows lower than the “Pessimistic” method result. That's why we recommend using the comparator if there are a number of ambiguous bars.