In the Cleanup() event, I use the following code that I would like to visualize as a line chart series in the Backtest Results tab section of the Strategy window.
Is there a chance to get a Performance Visualizer API WPF template? This would save a lot of time to figure out, how to code the user control and how to interact with the strategy window?
Thanks...
CODE:
public override void Cleanup(BarHistory bars) { List<DateTime> tempList = new List<DateTime>(); DateTime startDate; DateTime endDate; foreach (Position p in GetPositionsAllSymbols()) { startDate = p.EntryDate; if (p.ExitDate.ToString().StartsWith("31.12.9999")) { endDate = DateTime.Today; } else { endDate = p.ExitDate; } for (var dt = startDate; dt <= endDate; dt = dt.AddDays(1)) { tempList.Add(dt); } } DrawHeaderText("Days with largest overlap of trades:", Color.Black, 12); var results = tempList.GroupBy(n => n).Select(c => new { Key = c.Key, total = c.Count() }).OrderByDescending(g => g.total).Take(20); foreach (var result in results) { DrawHeaderText(result.Key + " - " + result.total, Color.Black, 12); } }
Is there a chance to get a Performance Visualizer API WPF template? This would save a lot of time to figure out, how to code the user control and how to interact with the strategy window?
Thanks...
Rename
Don't know XAML at all, so what exactly do I need to change in the XAML User Control Manifest?

It would be really helpful if a sample code would be available at https://www.wealth-lab.com/Support/ExtensionApi/PerformanceVisualizer. The "meager documentation" eats up hours of effort and causes unnecessary inquiries in the discussion board.
Thansk!
CODE:
<UserControl x:Class="PerformanceVisualizers.UserControl1" xmlns="<a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation" target="_blank">http://schemas.microsoft.com/winfx/2006/xaml/presentation</a>" xmlns:x="<a href="http://schemas.microsoft.com/winfx/2006/xaml" target="_blank">http://schemas.microsoft.com/winfx/2006/xaml</a>" xmlns:mc="<a href="http://schemas.openxmlformats.org/markup-compatibility/2006" target="_blank">http://schemas.openxmlformats.org/markup-compatibility/2006</a>" xmlns:d="<a href="http://schemas.microsoft.com/expression/blend/2008" target="_blank">http://schemas.microsoft.com/expression/blend/2008</a>" xmlns:local="clr-namespace:PerformanceVisualizers" xmlns: mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> <Grid> </Grid> </UserControl>
It would be really helpful if a sample code would be available at https://www.wealth-lab.com/Support/ExtensionApi/PerformanceVisualizer. The "meager documentation" eats up hours of effort and causes unnecessary inquiries in the discussion board.
Thansk!
Would something like this do the job?
Remove the space between "http" and "://..." - I inserted it to work around the website's syntax highlighter kicking in even in code blocks.
CODE:
<uc:VisualizerBase x:Class="PerformanceVisualizers.UserControl1" xmlns="http ://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http ://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http ://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http ://schemas.microsoft.com/expression/blend/2008" xmlns:uc="clr-namespace:WealthLab.WPF;assembly=WealthLab.WPF" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> <Grid> </Grid> </uc:VisualizerBase>
Remove the space between "http" and "://..." - I inserted it to work around the website's syntax highlighter kicking in even in code blocks.
Thanks, that has worked...
Now to my actual problem: How do I get the GetPositionsAllSymbols() function in the Populate() method, so that I can generate and aggregate the list for the line chart for the CreateLineSeries() method?
The WL7 API documentation is really very thin. Under Quantacula, Glitch allways published a sample code snippet....
Now to my actual problem: How do I get the GetPositionsAllSymbols() function in the Populate() method, so that I can generate and aggregate the list for the line chart for the CreateLineSeries() method?
CODE:
using System.Windows.Media; using WealthLab.WPF; using WealthLab.Backtest; using WealthLab.Core; using Steema.TeeChart.WPF; namespace PerformanceVisualizers { public partial class OverlappingPositions : VisualizerBase { public new IStrategyHost ParentStrategyWindow; public new Backtester Backtester; public new Backtester BacktesterBenchmark; public OverlappingPositions() { InitializeComponent(); } public override void Populate(Backtester backtester, Backtester backtesterBenchmark) { } public override void Initialize() { } public void ChartSetup(TChart chart) { } public System.Windows.Shapes.Line CreateLineSeries(TChart chart, Color color, string title) { return null; } } }
The WL7 API documentation is really very thin. Under Quantacula, Glitch allways published a sample code snippet....
WealthScript methods do not operate inside Visualizers. Backtester backtester has the Positions property you're looking for.
I guess I must be blind, at least I can't find what I am looking for...

Why not just publish a code example showing how the backtester information interacts with the charting functions? I can imagine that questioning and time wasting immediately stops ;-)
Why not just publish a code example showing how the backtester information interacts with the charting functions? I can imagine that questioning and time wasting immediately stops ;-)
On top of your screenshot...
CODE:
public PositionList Positions public PositionList OpenPositions
QUOTE:
Why not just publish a code example showing how the backtester information interacts with the charting functions? I can imagine that questioning and time wasting immediately stops ;-)
I hear you, the API Extension documentation could use some fleshing out. We have a large backlog of feature requests however, so it's just a matter of prioritizing. Also, by answering questions here we're building up our online knowledge base so we can point future questions here as they come up.
The Backtester class (https://www.wealth-lab.com/Support/ApiReference/Backtester) is documented, along with the Positions property therein, and we'll expand and improve the docs once the backlog goes down some.
QUOTE:
We have a large backlog of feature requests however, so it's just a matter of prioritizing. Also, by answering questions here we're building up our online knowledge base so we can point future questions here as they come up.
Glitch,
Unlike the Quantacula forum, in the new WL7 forum you have to fight for every straw, which makes you defenesive over time, which again can't be the goal of a community sharing ideas among each other. Anyway, I'll be patient in that case, since extensions are obviously not an absolute priority.
Just putting this item to the feature request list.
#FeatureRequest
#FeatureRequest
Your Response
Post
Edit Post
Login is required