Log Analyzer – Example of Log Pattern Analysis

In this example we will demonstrate how the Log Analyzer performs Log Pattern Analysis and conveniently present the results in Graphical form.

Download Free Log Analyzer (Windows)

The example is from the field of Automated Trading Software. The log we are going to study is generated by a Testing Framework being developed in Forex Strategy Tester project.

If you are not familiar with this area, it is not a problem. No specific knowledge is needed to understand the example. All you need to know is that the Strategy Tester Logs the profit of each trade it analyzes, and profit of each trade is logged as a separate Log Line. The advantage of taking this example is to demonstrate that the Log Viewer is a powerful tool that is capable of analyzing various log files.

So let’s get started. We have the Strategy Tester Log File ready, and opening it is no different as in any Windows Software: we go to Menu “File” and select “Open Log”, then select a log file name from our computer.

Free Log Analyzer Opened A Log File
On Loading a Log File, Log Analyzer gives you a “big picture” of log events’ dynamics

As we see, Log Analyzer found 26026 Log Events and it marked that a Log File spans 18301s. Here we need to make a note that for our particular example, the horizontal axis is not seconds (not usual for log files). The Strategy Tester logs every tick (i.e. a new price quote) that it receives from the trading server or its emulator. So in our example what would have been a timestamp in majority of Log Files, is just a tick number. Tick number does not correlate with time, as the trading server can either send multiple quotes per second or sometimes several seconds may pass between ticks. Log Events are not correlated with ticks either, as there can be multiple actions logged for every tick.

Now, after this introduction, let us use Log Pattern Analysis functionality to study the profitability of trades that the Strategy Tester logged. Let’s open the text view of the log and seatch for the word “profit” that is encountered in the log lines written after the trades are closed.

Open the Text Mode window (Menu “Windows” -> “Log”…) and enter our search word in the “Find” field. Make sure the box “Show all events” is not ticked, so that only the log lines containing the search phrase will be shown. Then press “Next” button. Log Viewer will show all occurenses of the Log Pattern as seen on the figure below:

Log Analyzer: Searching For Log Patterns In Text Mode
Log Analyzer Searches for given Log Pattern in the Text Mode

Now we can visualize any occurrence of the word “profit”. For that, we open a “Patterns” window (Windows” -> “Patterns”) and create there a new Log Pattern with name “profit” using the regular expression *profit*:

Log Analyzer - Pattern Window
We created a new Log Pattern in a special window

Next we press “Reload” button, the pattren will be saved and Log File Analyzer will show us a picture like this (we also zoomed in here to see details):

Log Analyzer Shows Log Pattern Occurences
Log Analyzer shows all occurences of the selected Log Pattern

We can see that the zoomed in part of our log has 233 events, and among them there are 4 closed trades, marked as black circles.
This was the simplest example that gave you some initial idea how we can use Log Patterns in our Graphical Log File Analyzer. Next, we will show some more complicated stuff.

Advanced Log Pattern Analysis With Log Analyzer

In previous example, we got occurenvces of a Log Pattern “profit” – i.e. closed trades – plotted against time (or a tick number, being more precise). Let us now try to get each trade profit be written on the graph as the caption for every occurrence of the Log Pattern.
This requires some regular expression skills. You can note that there are 2 types of Log Lines with word “profit”, which is because 2 difference mechanisms are used to close trades. We need to have the regular expression that would fit both cases. We can add this expression into the pattern we just created:

Log Analyzer uses regular expression for Log Pattern Analysis
Advanced regular expression will fit all types of trade closing and print a trade profit as a caption

Now, pressing the “Reload” button, we will get the plot of trades with profits typed as a caption (again, some zooming has been done):

Log Analyzer supports Value Patterns
Log Analyzer plots found patterns with caption

Details on the syntax of the Regular Expressions used by the Log Analyzer can be found in the User Guide.

As you might have noticed, the field where we entered our regular expressions, was called Value Pattern. This means that we were concerned with one value inside a Log Line that matches our search criteria.

Value pattern is the simplest case. In more complicated cases, we could additionally look for some log events that should occur prior or after the value string. So, for the case in point, natural opening event could have been opening the order in question. Such “start/stop” patterns, will be plotted as lines not dots. Using Start/Stop patterns brings additional dimentions to Log Pattern Analysis, making the Log Viewer even more powerful tool.

Log Analyzet tool also provides Statistical Analysis functionality for dealing with such cases. But this one is outside of the scope of the current example and will be covered separately.

Download Free Log Analyzer (Windows)

Leave a Reply

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

Please help us keep spammers away! * Time limit is exhausted. Please reload the CAPTCHA.