- ago
In WL6 StrategyName property was used.
I looked at UserStrategyBase methods/properties but couldn't find the equivalent.
0
731
Solved
8 Replies

Reply

Bookmark

Sort
- ago
#1
StrategyName it is.
CODE:
WriteToDebugLog(this.StrategyName);
0
- ago
#2
Allow me to clarify, WL6 stategyname was able to get the strategy file name. How can I get it that with WL7?
0
- ago
#3
I get it like this:

CODE:
this.ToString().Split(".")[^1]

It works for compiled strategies. Maybe it works for other strategies as well.
0
- ago
#4
QUOTE:
It works for compiled strategies. Maybe it works for other strategies as well.

At the moment, it won't work in code-based strategies.
QUOTE:
Allow me to clarify, WL6 stategyname was able to get the strategy file name. How can I get it that with WL7?

What's the purpose of getting the strategy's .txt file name?
0
- ago
#5
QUOTE:
What's the purpose of getting the strategy's .txt file name?


The testing scripts are numbered (X1, X2, etc) for version control. The actual trading scripts are named simply "X".
The script behaves based on its name. So, for example, in testing the debugging is turned on, and "production" it's off. There are other examples/reasons.
This methodology worked great in WL6 and it would be a big time-saver not having to devise new methods.
0
- ago
#6
You do have the this.StrategyName, and I can't see it in your response doesn't why you think you need the file name. Moreover, there is no file name for compiled strategies.
0
- ago
#7
The code returns: "MyStrategy".
Using the methodology I mentioned above I can't tell if this is a test/debug script or "production".
I'm still new to WL7. Let's see if I can devise another way.
0
- ago
#8
I see. File name is decoupled from UserStrategyBase so the property returns the class name - which you can adjust to mark test strategies accordingly.
2
Best Answer

Reply

Bookmark

Sort