Example:
GE stock on the 2011/6/8 has data
calculate 2011/6/8 LogReturn error message
Strategy Setting :
Code :
Debug Log :
Thx
GE stock on the 2011/6/8 has data
calculate 2011/6/8 LogReturn error message
Strategy Setting :
Code :
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript7 { public class _Ask : UserStrategyBase { private LogReturn _LogReturn; public override void Initialize(BarHistory bars) { _LogReturn = new LogReturn(bars.Close, 20); bars.Cache["Return"] = _LogReturn; StartIndex = 20; } public override void PreExecute(DateTime dt, List<BarHistory> participants) { foreach (BarHistory bh in participants) { try { LogReturn _LogReturn = (LogReturn)bh.Cache["LogReturn"]; } catch (Exception ex) { WriteToDebugLog(" Symbol = " + bh.Symbol + " Date = " + bh.GetDate(GetCurrentIndex(bh)) + " Exception = " + ex); } } } public override void Execute(BarHistory bars, int idx) { } } }
Debug Log :
Thx
Rename
This has nothing to do with LogReturn. Do you already see what I see i.e. the mismatch between the string values "Return" and "LogReturn" in your script?
CODE:
bars.Cache["Return"] = _LogReturn;
CODE:
LogReturn _LogReturn = (LogReturn)bh.Cache["LogReturn"];
Your Response
Post
Edit Post
Login is required