Hi Team,
Could I get a verification that it's not just my system not working. It seems like when I have a strategy with parameters that I want to optimize, and then have the MCP test the various permutations of the parameters I set in the range, the strategy keeps running with the default settings, ignoring the single-run parameter settings passed.
MCP run_backtest/submit_backtest parameters field is accepted but ignored at runtime. WL9 build 9.0.12.0, MCP Streamable HTTP endpoint.
The backtest request accepts a parameters object (keyed by parameter label) and echoes it back in the job's request echo, but the strategy instance is constructed with constructor defaults — the passed values never reach Parameter.AsInt/AsDouble.
Minimal repro:
1) I had a test strategy with two AddParameter Int32 params, defaults 35/70, that WriteToDebugLogs the received values at StartIndex:
_buyRsi = AddParameter("Buy RSI", ParameterType.Int32, 35, 20, 45, 5);
_sellRsi = AddParameter("Sell RSI", ParameterType.Int32, 70, 55, 80, 5);
2) submit_backtest with "parameters": {"Buy RSI": 25, "Sell RSI": 75} on NUGT, Minute scale.
3) Debug log shows Buy RSI=35 Sell RSI=70 (the defaults).
4) Second run with {"Buy RSI": 45, "Sell RSI": 55} → byte-identical metrics and identical debug line.
thanks,
-bd
#BugReport
Could I get a verification that it's not just my system not working. It seems like when I have a strategy with parameters that I want to optimize, and then have the MCP test the various permutations of the parameters I set in the range, the strategy keeps running with the default settings, ignoring the single-run parameter settings passed.
MCP run_backtest/submit_backtest parameters field is accepted but ignored at runtime. WL9 build 9.0.12.0, MCP Streamable HTTP endpoint.
The backtest request accepts a parameters object (keyed by parameter label) and echoes it back in the job's request echo, but the strategy instance is constructed with constructor defaults — the passed values never reach Parameter.AsInt/AsDouble.
Minimal repro:
1) I had a test strategy with two AddParameter Int32 params, defaults 35/70, that WriteToDebugLogs the received values at StartIndex:
_buyRsi = AddParameter("Buy RSI", ParameterType.Int32, 35, 20, 45, 5);
_sellRsi = AddParameter("Sell RSI", ParameterType.Int32, 70, 55, 80, 5);
2) submit_backtest with "parameters": {"Buy RSI": 25, "Sell RSI": 75} on NUGT, Minute scale.
3) Debug log shows Buy RSI=35 Sell RSI=70 (the defaults).
4) Second run with {"Buy RSI": 45, "Sell RSI": 55} → byte-identical metrics and identical debug line.
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; namespace WealthScript3 { public class McpParamProbe : UserStrategyBase { private Parameter _buyRsi; private Parameter _sellRsi; private RSI _rsi; public McpParamProbe() { _buyRsi = AddParameter("Buy RSI", ParameterType.Int32, 35, 20, 45, 5); _sellRsi = AddParameter("Sell RSI", ParameterType.Int32, 70, 55, 80, 5); StartIndex = 20; } public override void Initialize(BarHistory bars) { _rsi = new RSI(bars.Close, 14); } public override void Execute(BarHistory bars, int idx) { if (idx < StartIndex) return; if (idx == StartIndex) WriteToDebugLog("PARAMS RECEIVED| Buy RSI=" + _buyRsi.AsInt + " Sell RSI=" + _sellRsi.AsInt); if (HasOpenPosition(bars, PositionType.Long)) { if (_rsi[idx] >= _sellRsi.AsInt) ClosePosition(LastPosition, OrderType.Market, 0, "RSI exit"); } else { if (_rsi[idx] <= _buyRsi.AsInt) PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0, "RSI entry"); } } } }
thanks,
-bd
#BugReport
Rename
No, it's not you - it's us. We'll get those parameters working in the MCP in Build 14!
Thanks Glitch!
great work Glitch and team! Thanks for fixing the MCP parameter pass. You guys are amazing! This is a huge edge. Linking an MCP connection to WL9 allows for backtesting in seconds with certain parameter pass optimization runs. This is going to be awesome. Thanks again.
Your Response
Post
Edit Post
Login is required