Overall Statistics Total Trades 225 Average Win 0.75% Average Loss -0.70% Compounding Annual Return 4.255% Drawdown 23.700% Expectancy 0.164 Net Profit 12.927% Sharpe Ratio 0.38 Loss Rate 44% Win Rate 56% Profit-Loss Ratio 1.08 Alpha 0.045 Beta 0.036 Annual Standard Deviation 0.132 Annual Variance 0.017 Information Ratio -0.546 Tracking Error 0.178 Treynor Ratio 1.388 Total Fees \$382.96
```using System;
using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data.Market;
using QuantConnect.Data.UniverseSelection;

namespace QuantConnect.Algorithm.CSharp
{
// In this algorithm we show how you can easily define a
// universe using our coarse selection data. This data includes
// a few properties, including the daily DollarVolume, the daily Volume
// and also the daily closing price via the Value property.
public class CoarseFundamentalTop5Algorithm : QCAlgorithm
{
// initialize our security changes to nothing
SecurityChanges _changes = SecurityChanges.None;

public override void Initialize()
{
// this sets the resolution for securities added via universe selection
UniverseSettings.Resolution = Resolution.Minute;

SetStartDate(2013, 1, 1);
SetEndDate(2015, 12, 1);
SetCash(50000);

// this add universe method accepts a single parameter that is a function that
// accepts an IEnumerable<CoarseFundamental> and returns IEnumerable<Symbol>
{
// Properties available on the CoarseFundamental type 'stock'
// stock.DollarVollume
// stock.Value (daily close)
// stock.Volume
// stock.Market
//
return (from stock in coarse
orderby stock.DollarVolume descending
select stock.Symbol).Take(5);
});
}

// sort the data by daily dollar volume and take the top 5 symbols
public static IEnumerable<Symbol> CoarseSelectionFunction(IEnumerable<CoarseFundamental> coarse)
{
// sort descending by daily dollar volume
var sortedByDollarVolume = coarse.OrderByDescending(x => x.DollarVolume);
// take the top 5 entries from our sorted collection
var top5 = sortedByDollarVolume.Take(5);
// we need to return only the symbols
}

//Data Event Handler: New data arrives here. "TradeBars" type is a dictionary of strings so you can access it by symbol.
{
// if we have no changes, do nothing
if (_changes == SecurityChanges.None) return;

// liquidate removed securities
foreach (var security in _changes.RemovedSecurities)
{
if (security.Invested)
{
Liquidate(security.Symbol);
}
}

// we want 25% allocation in each security in our universe (total of 150% invested)
{
SetHoldings(security.Symbol, 0.25m);
}

// reset our changes
_changes = SecurityChanges.None;
}

// this event fires whenever we have changes to our universe
public override void OnSecuritiesChanged(SecurityChanges changes)
{
_changes = changes;
}
}
}```