Glitch8
 ( 7.81% )
- ago
Moving these from a Discord PM to get them here into the public knowledge base:

1. Question:
QUOTE:
How do you connect WLHost.Instance.ExpertMode to the Visibility of some widgets? I.e. how gets the NotifyPropertyChanged event fired for this Visibility?

Answer: Override the ChildWindow SetExpertMode method.

2. Question:
QUOTE:
What is the code behind your "Evolver Preferences" Button, i.e. how can I open my Preferences page from a button?

Answer: Call ChildWindow.MyClientHost.ShowPreferences("Name of Preference Page");

3. Question:
QUOTE:
When I activate an extension from the extensions menu a second time, how can I open the first extension instead of creating a second Child Window?

Answer: We don't support this directly, add a #FeatureRequest to get this supported in the framework. But if you don't mind digging into some lower level code, this will do it:

CODE:
//click handler for generated menu item private void mniClick(object sender, RoutedEventArgs e) { Window wnd = MyClientHost as Window; MdiContainer container = wnd.FindName("mdiContainer") as MdiContainer; foreach(MdiChild mdichild in container.Children) { if (mdichild.Content is cwCandlesticks) { mdichild.Focus(); return; } } CreateChildWindow(); }
0
617
12 Replies

Reply

Bookmark

Sort
- ago
#1
I'm in the process of developing a Performance Visualizer (inherits from VisualizerBase).

At the end of a backtest he Populate() method is called with a Backtester.
This Backtester has a set of metrics:
CODE:
MetricsBundle mb = backtester.Metrics;

These metrics are always empty.

What can I do to find the metrics of this backtester?
0
Glitch8
 ( 7.81% )
- ago
#2
Not sure how this can be possible since all the other visualizers can access the metrics.
0
- ago
#3
I have to do this in Populate():
CODE:
List<ScoreCardBase> scList = ScoreCardFactory.ScoreCards; foreach (var scb in scList) { scb.Initialize(backtester); }
Otherwise some(!) metrics are missing....
0
Glitch8
 ( 7.81% )
- ago
#4
I'm not sure what you mean by "missing."

Are you accessing metrics by their metric name?

Here's a line in the Equity Curve Visualizer, for example, and this code does return the valid metric value and is called from Populate.

CODE:
double corr = Backtester.Metrics.CorrBenchmark;
0
- ago
#5
I use code like this to access the metrics in the backtester:
CODE:
MetricsBundle mb = backtester.Metrics; foreach (string mname in metricNames) { if (mb.HasMetric(mname)) { object value = backtester.Metrics.GetMetric(mname); ... } }

Without the ScoreCardBase.Initialize() I do not find any metrics from
* Advanced ScoreCard: DD0Time, etc.
* ExpDD and SysQ: SysQ, ExpDD
* Extended ScoreCard: MaxConsecutiveWins, etc
* Formula ScoreCard: SharpeRatioDaily, etc
* Insample/OutOfSample

Looks like metrics from Basic ScoreCard are present only.
0
Glitch8
 ( 7.81% )
- ago
#6
The Scorecard will not “have” any metrics until the first one is requested, they are generated upon access, so if you remove the HasMetric test then let’s see if that helps.
1
- ago
#7
QUOTE:
they are generated upon access, so if you remove the HasMetric test

This works!

... feels a bit like black magic though....
0
Glitch8
 ( 7.81% )
- ago
#8
It's a way to eliminate unnecessary processing.
0
- ago
#9
When I use WLButton to make the look-and-feel as WL7-like as possible:
Is there an easy way to get these nice icons? E.g. a "Save" Icon in the "Save" button?
0
Glitch8
 ( 7.81% )
- ago
#10
Use the WLButton Image property in your xaml. You’ll need to have your own image files in your project with their type set to Resource in Visual Studio.
0
- ago
#11
Suppose I have an extension which is able to create "The Ultimative Trading Strategy".
It has a button labeled "Create UTS".

The extension would create a file in "Strategy export Format" i.e. exactly the same format which is created when I export a coded strategy.

How can I read such a file into WL (from code)?

I.e. how can I do the same as "Import strategy" from an extension's code?
0
Glitch8
 ( 7.81% )
- ago
#12
The programmatic way to add a new Strategy would be to use StrategyFactory.Save.
0

Reply

Bookmark

Sort