- ago
I consider WL's Building Blocks as a great way to generate (otherwise complicated) code. I tend to build more and more building blocks that do more and more complicated things.

With such complex code generation tools in place I miss two things from the current incarnation of building blocks:

1. Error reporting.
When something goes wrong during the code generation I can just throw an (ugly) exception.
If the generated code is bad WL simply says "could not compile"
Both are not very helpful. Would be nice if I could create some nice Error message which is shown in red close to the respective building block

2. Action Button
Some Parameters for my building blocks (may) contain complicated expressions. It is hard to enter such an expression without assistance. I'd like to have some (optional) "Action Button" close to the string parameter which opens a specialized GUI/Dialog - provided by my building block - and allows the selection of various elements for the string parameter. This could look and work similar to the "Make Optimizable..." button for int/double parameters.
11
861
5 Replies

Reply

Bookmark

Sort
- ago
#1
And one more:

3. Description / Comments
In a complex building block strategy it could be helpful to have the possibility to add some comment or description for an individual block. This helps maintainability (if you consider to modify such a strategy after a couple of weeks).
Such a comment should be transported to a C# comment if the "Open as C# Coded Strategy" button is clicked.

With the latter case it would help people who start with a building block strategy, convert to C# and refine/enhance without getting lost in the C# code.

Then there is a new extension on the way which produces building blocks form a high level description of a trading strategy. Such an extension would use the new comments to store the original description of the moving parts . This makes the resulting building block strategy more understandable. And if converted to C# code: See above.
0
Cone8
 ( 2.12% )
- ago
#2
1. "could not compile" is an error in the block coding for the developer.
0
- ago
#3
QUOTE:
for the developer.


Hmmm. The new FxBlocks (availble with the finantic.Eval extension) allow an non-coder to enter "Indicator Formulas" for limit and stop prices.

My favorite example for an entry limit price being:
CODE:
Close - Close * {f1}/100.0 - {f2} * ATR(bars, 12)
If there is a typo in one of these formulas, the mere mortal user just gets the "Could not compile" message and I get an email with a request to explain things.

I tell people to
1. click "Open as C# Coded Strategy", then
2. on "Compile" then
3. examine the error message,
4. extract the line number,
5. locate the offending code line and
6. see if the problem is obvious.

Steps 1.) to 5.) would go away if the original error message was "nicer".
0
- ago
#4
QUOTE:
In a complex building block strategy it could be helpful to have the possibility to add some comment or description for an individual block.


A friend had this brilliant idea:


Instead of publishing another finantic extension (the smallest ever) I'd suggest to add this to WL's core set of Building Block.

The complete implementation looks like this:
CODE:
using WealthLab.Backtest; namespace CommentBlock { public class CommentBlock : ConditionBuildingBlock { public override string Name => "Comment"; public override string Description { get { string text = Parameters[0].AsString; if (string.IsNullOrEmpty(text)) return "Comment"; if(text.Length > 80) return text.Substring(0, 77) + "..."; return text; } } public override void Initialize() { LibraryName = "Comment"; } public override void GenerateParameters() { AddParameter("Comment", WealthLab.Core.ParameterType.Text, ""); } public override void GenerateConditionCode() {} } }
0
Glitch8
 ( 5.10% )
- ago
#5
Interesting idea, but my feeling is that such a comment Block shouldn’t be in the core group. I really want to keep them stripped down to the basics. Also, the Strategy description box is the natural place to write comments so I see this Block as duplicating functionality we already have a place for.
0

Reply

Bookmark

Sort