- ago
I subscribed to Fundamentals extension,
But do not see EPS surprises item in Fundamentals items selection box.
What am I missing?

1
492
Solved
4 Replies

Reply

Bookmark

Sort
Glitch8
 ( 9.28% )
- ago
#1
Did you look at the Zacks Event Provider?

0
Best Answer
- ago
#2
Thank you - eps surprise appears on the chart as advertised.
Trying EPS surprise code-based strategies.
0
Glitch8
 ( 9.28% )
- ago
#3
Here's an example that buys on a positive earnings surprise and sells after holding 10 bars.

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; using System.Globalization; namespace WealthScript1 { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { } //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)) {             //code your buy conditions here             List<EventDataPoint> lst = bars.GetEventDataPoints("Earnings", idx);             if (lst.Count == 1)             {                EventDataPoint edp = lst[0];                if (edp.Details.ContainsKey("Surprise"))                {                   string s = edp.Details["Surprise"];                   s = s.Replace("+", "");                   //WriteToDebugLog(s);                   if (s.Trim() != "")                   {                      double surprise = Double.Parse(s, CultureInfo.InvariantCulture);                      if (surprise > 0)                      {                         PlaceTrade(bars, TransactionType.Buy, OrderType.Market);                      }                   }                }                //foreach(KeyValuePair<string, string> kvp in edp.Details)                //   WriteToDebugLog(kvp.Key + "=" + kvp.Value);             } } else { if (idx - LastPosition.EntryBar >= 10)                PlaceTrade(bars, TransactionType.Sell, OrderType.Market); } } //declare private variables below } }
1
- ago
#4
@flanda
And for a strategy that tries to exploit a strong history of positive earnings surprises, check your strategy folders after installing the Fundamental extension.
1

Reply

Bookmark

Sort