When I run EPS surprisesv2 strategy from fundamental folder it spits out this error message in the bottom of attached screenshot. I do have fundamental extension installed. I am on build 80, using default setup.
Rising EPS trend is also not working
Rising EPS trend is also not working
Rename
Add a "using WealthLab.Data" up top, we'll need to make that change in this Strategy.
After adding using wealthlab.data, it works on sp100 and nasdaq100 data but not on sp500.
Trying to duplicate it.
Were you using Wealth-Data S&P 500?
What was the backtest Data/Date Range?
Were you using Wealth-Data S&P 500?
What was the backtest Data/Date Range?
wealth lab sp500, last 10 years
Same here, but no error.
You've checked the Zacks Event(s)?
You've checked the Zacks Event(s)?
Zacks is checked. This last error is in rising eps trend strategy not in EPS surprise v2.
In my view some symbol - supposedly delisted - can't be recognized, causing this. Try to run it on Yahoo's S&P DataSet as that does not contain delisted symbols.
We need to add some error protection to the code and fix other bugs for B81.
We need to add some error protection to the code and fix other bugs for B81.
This version is working for me, powered by Zacks fundamentals on Wealth-Data's S&P 500 DataSet:
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Drawing; using System.Collections.Generic; using System.Linq; using WealthLab.Data; namespace WealthScript3 { public class RisingEPS : UserStrategyBase { public RisingEPS() { AddParameter("Positive EPS...", ParameterType.Int32, 3, 1, 12, 1); AddParameter("... in X years", ParameterType.Int32, 1, 1, 4, 1); } //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { _posEpsReqd = Parameters[0].AsInt; _howManyYears = Parameters[1].AsInt; if (bars.EventDataPoints.Count == 0) return; //don't process a symbol with no positive earnings lstEarnings = bars.EventDataPoints.Where(i => i.Value > 0 && i.Name == "Earnings").ToList(); if (lstEarnings.Count == 0) { DrawHeaderText("Activate an event provider with Earnings data and update prior to running this Strategy.", WLColor.Red, 14); DrawHeaderText("If Earnings data is available, current symbol hasn't had positive earnings.", WLColor.Orange, 12); return; } } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { if (!HasOpenPosition(bars, PositionType.Long)) { //list of earnings releases var yearAgo = bars.DateTimes[idx].Date.AddYears(-_howManyYears); var today = bars.DateTimes[idx].Date; if (lstEarnings != null) { var recentEarnings = lstEarnings.Where(i => i.Date >= yearAgo && i.Date.Date <= today).TakeLast(_posEpsReqd).ToList(); if (recentEarnings.Count >= _posEpsReqd) PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0, recentEarnings.Count.ToString()); } } else { int days = 90; Position p = LastPosition; if (idx + 1 - p.EntryBar >= days) ClosePosition(p, OrderType.Market); } } //declare private variables below List<EventDataPoint> lstEarnings; int _posEpsReqd, _howManyYears; } }
Your Response
Post
Edit Post
Login is required