- ago
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
0
426
Solved
9 Replies

Reply

Bookmark

Sort
Glitch8
 ( 12.53% )
- ago
#1
Add a "using WealthLab.Data" up top, we'll need to make that change in this Strategy.
0
- ago
#3
After adding using wealthlab.data, it works on sp100 and nasdaq100 data but not on sp500.
0
Cone8
 ( 6.17% )
- ago
#4
Trying to duplicate it.
Were you using Wealth-Data S&P 500?
What was the backtest Data/Date Range?
0
- ago
#5
wealth lab sp500, last 10 years
0
Cone8
 ( 6.17% )
- ago
#6
Same here, but no error.
You've checked the Zacks Event(s)?
0
- ago
#7
Zacks is checked. This last error is in rising eps trend strategy not in EPS surprise v2.
0
- ago
#8
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.
0
- ago
#9
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;    } }
0
Best Answer

Reply

Bookmark

Sort