Enhanced Strategy Log request
Author: LenMoz
Creation Date: 5/25/2013 11:55 PM
profile picture

LenMoz

#1
Purpose
Enhance productivity while testing strategies. For me, the Debug Log falls short for a backtest, especially a multi-symbol backtest of the S&P 500. This is a proposal for a more robust log facility.
Implementation
In-memory data structure, not persistent (unless exported, below)
Data Structure Fields
1. Symbol
2. Date
3. Key (short freeform, 20[?] character limit)
4. Severity, one character, ([O]bserve, [W]arning, [F]atal, [D]ebug), strategy author's definition
5. Free-form text
Display Screen (New tab, “Log”, on the Strategy screen)
1. Display all data structure fields
2. Filter on any field except the “free-form text”, default to showing all data. Allow for a range of dates.
3. Sort by symbol or date, default to by symbol, then by date. Sorting by date lets you see clustering, where many symbols exhibited some behavior.
4. Double-click to open the chart positioned to the date of the log (like the “trades” tab)
5. Implement “Export to .csv”, as currently filtered and sorted, prompt for path and filename
6. Remember filter and sort preferences, at least until WLP is shut down, or (better) with the strategy like “Parameters”.
Programmatic Interface
PrintLog(bar, key, severity, text);
Note: Printlog supplies the current symbol behind the scenes, and similarly translates “bar” to a date. By convention, use bar “-1” (minus one) for messages outside the main loop.
Upfitting strategy code is quick. Globally replace…
PrintDebug(
by
PrintLog(bar, “Dbg”, “D”,
… then fix up as required, might use key of “Buy” for buy strategy messages, “Sell” for sell messages.
Other
PrintLog should be ineffective when optimizing or when run by Strategy Monitor
Clear the log at time of other Visualizers
System could also use the log for messages, using key of “System”, or other more specific text
profile picture

Eugene

#2
You're welcome to design (this has been done) and implement any method for logging, and include it in your own class library. For example, see how downloadable strategy Correlation Matrix uses a method from Community.Components, sending HTML formatted output to it:

CommentaryWindow

Also, Wealth-Lab comes with a preinstalled logging component - log4net.
profile picture

LenMoz

#3
I was simply stating what would make my life easier, without having to install a lot of extra code in each strategy. I'm not a .Net developer. My first exposure to the C# language was 4 months ago.

Per the spirit of this category...

QUOTE:
Discuss features of Wealth-Lab Pro and Developer. Let us know what you want to make this your ultimate trading system development tool!


Len
profile picture

Eugene

#4
Len, Wealth-Lab's trademark extensibility has always been its strong point. If something that a user envisioned can be implemented through the many interfaces exposed, then it's the preferred way of making it as opposed to touching the Wealth-Lab client. It takes a significant demand to consider a feature request. Based on experience, installing a few lines of code in each strategy is far easier and way more realistic than expecting that Fidelity would add a new WealthScript method.
profile picture

LenMoz

#5
Forget it. I'll use it as it is. I'm not going to learn a new IDE and incur future maintenance of a personal class library dependent on WLP interfaces. My goal is to develop trading strategies.

Len
profile picture

pscanlon1

#6
I went to install log4net with package manager console in my .dll, and now wealth lab doesnt start. I dont see log4net referenced in any of the add-ins ( i have TASC, Community, and Indicators). What am I missing?
profile picture

Eugene

#7
log4net is a built-in component required by Wealth-Lab core. You probably have overwritten it with a version that has unsuitable bitness, breaking change in syntax etc. Try deleting the new log4net.dll and repairing Wealth-Lab installation from Windows Control Panel.
profile picture

psimmons

#8
I'm looking to implement a logging mechanism.

1) I see that Wealth-Lab uses log4net already, and assume I could utilise this, but I wanted to ask first.
I do want a RollingLogFile, similar to what is implemented. I have verified that I can add entries in the manner I want, but I would prefer my own log file, am not sure of any implications of adding my own entries into the wlp.log file, and am concerned of having multiple processes writing to wlp.log.

2) I would prefer my own log4net instance that my strategy can write to.
I'm fairly sure there must be a way for WealthLabPro.exe.config to be configured to support this, but I am still investigating how to do this (https://stackoverflow.com/questions/23015507/log4net-multiple-loggers) and am concerned about performance for a 1min scale strategy, and any other unintended ramifications that I am unaware of.

3) I could avoid log4net altogether and use Windows EventLog or another logger, but I don't like EventLog's need to raise to administrator access control and would rather not take this approach.

4) I could build my own logger, but I don't want to re-invent the wheel.

Can you advise which approach to take please?
Thanks
Phil

profile picture

Eugene

#9
QUOTE:
and am concerned of having multiple processes writing to wlp.log.

Phil, I would be concerned too as this might "void your warranty". So my question is: why should you be writing to wlp.log if it's possible to specify any other file via the "file value=" attribute? Your SO link sounds like that multiple loggers may be feasible.
profile picture

psimmons

#10
Thanks Eugene, I will experiment further with multiple loggers