- ago
Hi,

I know there must be a simple answer but can not find it.
"You should override the following descriptive properties in your Strategy classes.
public virtual string StrategyName
Return a descriptive name for the Strategy. The default implementation returns the .NET class name."
https://wealth-lab.com/Support/ExtensionApi/StrategyLibrary

How do I do that?
Thanks.
0
726
Solved
11 Replies

Reply

Bookmark

Sort
- ago
#1
Hi,

Are you developing a strategy library? Because the API reference link refers to this domain only. Note that this is not a way to set strategy name through code in the Editor.
0
- ago
#2
Hi Eugene,

Thanks for your reply. Yes I am building a Strategy Library following https://wealth-lab.com/Support/ExtensionApi/StrategyLibrary



My SWSOptionsIncome has been written in VS2022, compiled and written to wealthlab folder.
So I am expecting to be able to name my strategy something like "SWS Options Income" and author "Milton" like I see for PowerPack or Simple Strategies.
Looking at the symbols next to the strategies I notice mine is different, looks like a download symbol, where as most of the others seem to have a C#+ double cog symbol.
What do these symbols mean and does it indicate I have done something wrong?
0
MIH8
- ago
#3
If I understand correctly what you want to do, then you just need to rename the class name. The class name will be visible as the name for the strategy.
0
- ago
#4
@miltondorff

Surprisingly, those strategies from the PowerPack aren't good examples because they are embedded resources (plain text strategies, not compiled).

Anyway, it's extremely simple and that's how it should work:

CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; namespace WealthLab.PowerPack { public class TestCompiledStrategy : UserStrategyBase { public override string StrategyName => "Here I stand";




@MIH
QUOTE:
If I understand correctly what you want to do, then you just need to rename the class name. The class name will be visible as the name for the strategy.

No, that's incorrect.
1
Best Answer
MIH8
- ago
#5
I see you do it differntly but what do you mean with "incorrect"?
Creating an own library with different classes, the class name will result in the strategy name. What do i miss?



1
- ago
#6
You may be doing it differently but this way you cannot get a strategy name to contain spaces or special symbols.
0
MIH8
- ago
#7
Yes, i see, your approach is cleaner. Thanks.
0
- ago
#8
Thanks Eugene and MIH.

Appreciate your effort and as always Eugene your wisdom.

Works great.

VS 2022 was even smart enough to make that suggestion, I just was not familiar with it.
1
- ago
#9
@MIH
HI,
I noticed on your screen shot above, you have managed to get Trade BB as the top level.

How did you get a space in there? Best I have managed to do is .SWS.Project.Strategies, and this drops the opening "." to give me SWS.Project.Strategies.

Thanks.
0
MIH8
- ago
#10
"Trade BB" is the project name (dll name).
1
- ago
#11
HI,
Well who knew you can now have spaces in a dll name, missed that change.
Thanks
0

Reply

Bookmark

Sort