Wealth Lab Pro Earning Play Screener

This is a quick script that I use to find options to buy or sell.

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Components;

namespace WealthLab.Strategies
{
	public class MyStrategy : WealthScript
	{

		protected override void Execute()
		{
			DataSeries maFast = EMAModern.Series(Close, 50);
			DataSeries maSlow = EMAModern.Series(Close, 200);
			DataSeries maFast_1 = EMAModern.Series(Close, 10);
			DataSeries maSlow_2 = EMAModern.Series(Close, 50);
			DataSeries ma = EMAModern.Series(Close, 10);
			DataSeries maFast_3 = EMAModern.Series(Close, 10);
			DataSeries maSlow_4 = EMAModern.Series(Close, 50);

			PlotSeries(PricePane,EMAModern.Series(Close,50),Color.Red,LineStyle.Solid,2);
			PlotSeries(PricePane,EMAModern.Series(Close,200),Color.Green,LineStyle.Solid,2);
			PlotSeries(PricePane,EMAModern.Series(Close,10),Color.Blue,LineStyle.Solid,2);
			PlotSeries(PricePane,EMAModern.Series(Close,50),Color.Red,LineStyle.Solid,2);
			PlotSeries(PricePane,EMAModern.Series(Close,10),Color.Blue,LineStyle.Solid,2);

			//for(int bar = GetTradingLoopStartBar(201); bar < Bars.Count; bar++)
			int bar = Bars.Count - 1;
			{
				if (IsLastPositionActive)
				{
					Position p = LastPosition;
					if (p.EntrySignal.Contains("Group1|"))
					{
						if (CrossUnder(bar, maFast_3, maSlow_4))
						{
							SellAtMarket(bar + 1, p, "Group1");
						}
					}

				}
				else
				{
					if (maFast[bar] > maSlow[bar])
					{
						if (maFast_1[bar] > maSlow_2[bar])
						{
							if (Close[bar] < ma[bar])
							{
								if (EarningsDate.InWindow(this, bar, "earnings per share", 7, 0))
								{

									BuyAtMarket(bar + 1, "Group1|");
								}
							}
						}
					}

				}
			}
		}
	}
}
%d bloggers like this: