- ago
I'm not sure if the following is bug, or by-design, so I didn't mark this as a bug.

To re-create:
1. Open a strategy (the code for a simple cheesy strategy is below for a quick test).
2. Make sure the parameter(s) are set to the default values.
3. The "Reset Values to Defaults" button is not active as expected.
4. Change a parameter. The "Reset Values to Defaults" button is now active as expected.
5. Run the backtest. Go to the Strategy Settings tab. The "Reset Values to Defaults" button is not active even though at least one parameter is not currently at its default value. It seems like the button should be active.

So, maybe that's the way its suppose to work, or there is a bug. To me it seems like the "Reset Values to Defaults" button should always be active if at least one parameter is not at its default value.
CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; namespace WealthLabStrategies.Test; public class TestParamReset : UserStrategyBase { public TestParamReset() { ParamRsiPeriod = AddParameter("RSI Period", ParameterType.Int32, 4, 2, 20); } private RSI Rsi { get; set; } private Parameter ParamRsiPeriod { get; } private int RsiPeriod => ParamRsiPeriod.AsInt; public override void Initialize(BarHistory bars) { Rsi = RSI.Series(bars.Close, RsiPeriod); StartIndex = RsiPeriod; } public override void Execute(BarHistory bars, int idx) { switch (Rsi[idx]) { case < 30 when !HasOpenPosition(bars, PositionType.Long): PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0, -1, "Buy"); break; case > 70 when HasOpenPosition(bars, PositionType.Long): PlaceTrade(bars, TransactionType.Sell, OrderType.Market, 0, -1, "Sell"); break; } } }
0
49
0 Replies

Reply

Bookmark

Sort
Currently there are no replies yet. Please check back later.