GetNextEarningsDate

Modified on 2012/06/18 08:45 by Eugene — Categorized as: Community Components

Syntax


public static DateTime GetNextEarningsDate(string symbol)
public static DateTime GetNextEarningsDate2(string symbol)

Parameter Description

symbol The symbol (ticker) of a U.S. stock

Description

Returns the next earnings date of a stock. The second function is used for backup: they request the data from two different web-based sources.

Example

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Components; /*** Requires installation of Community.Components Extension from www.wealth-lab.com > Extensions ***/

namespace WealthLab.Strategies { public class GetNextEarningsDateDemo : WealthScript { protected override void Execute() { // Note: leave just one call uncommented DateTime nextDate = Utility.GetNextEarningsDate(Bars.Symbol); //DateTime nextDate2 = Utility.GetNextEarningsDate2(Bars.Symbol); for(int bar = GetTradingLoopStartBar(1); bar < Bars.Count; bar++) { if (IsLastPositionActive) { SellAtClose(bar + 1, LastPosition, "Exit 1 day later"); } else { if (Bars.Date[bar] != nextDate.Date) //if (Bars.Date[bar] != nextDate2.Date) if ( Close[bar] > 5 ) if ( SMA.Series( Volume, 90 )[bar] >= 50000 ) BuyAtLimit( bar + 1, Close[bar] * 0.93 ); } } } } }