- ago
is there any way to set the benchmark symbol programmatically to the current symbol? WL 6 did this but wl7 forces a change on every symbol if you want to do this.
0
376
Solved
5 Replies

Reply

Bookmark

Sort
Glitch8
 ( 12.08% )
- ago
#1
No there’s currently no way to change the benchmark symbol programmatically in WL8.
0
- ago
#2
Yes. It is explained in the C# Coding QuickRef:
Class: StrategyRunner

Example:
CODE:
using WealthLab.Backtest; using WealthLab.Core; using System; namespace WealthScript3 {    public class MyStrategy : UserStrategyBase    {       //Initialize       public override void Initialize(BarHistory bars)       {       }       //Execute       public override void Execute(BarHistory bars, int idx)       {       }       //Backtest Completed (executes once)       public override void BacktestComplete()       {          StrategyRunner sr = new StrategyRunner();          foreach (BarHistory bars in BacktestData)             sr.Symbols.Add(bars.Symbol);          sr.BenchmarkSymbol = "SPY";          Backtester bt = sr.RunBacktest("RSI Agita");          WriteToDebugLog("RSI Agita on backtested data with SPY benchmark Alpha= " + bt.Metrics.Alpha.ToString("N2"));          sr.BenchmarkSymbol = "QQQ";          bt = sr.RunBacktest("RSI Agita");          WriteToDebugLog("RSI Agita on backtested data with QQQ benchmark Alpha= " + bt.Metrics.Alpha.ToString("N2"));       }    } }
0
Best Answer
Glitch8
 ( 12.08% )
- ago
#3
We’ll yes that’s a roundabout way 🙂

Really a backtest within a backtest though.
0
- ago
#4
taking properties from the backtester does give some insight. What Im looking for is to see the generated equity curve by the strategy contrasted not with the "benchmark" but rather the symbol Buy and Hold, i.e. make the benchmark just be B&H of the symbol
0
- ago
#5
QUOTE:
... I'm looking for ... the generated equity curve by the strategy contrasted not with the "benchmark" but rather the symbol Buy and Hold, ...

WL6 includes a Buy and Hold case on the equity curve. You could post a feature request to do the same in WL8. It would be nice to have a checkbox to turn it on if desired.
0

Reply

Bookmark

Sort