| Overall Statistics |
|
Total Trades 2 Average Win 2.23% Average Loss 0% Compounding Annual Return 0.369% Drawdown 2.300% Expectancy 0 Net Profit 2.235% Sharpe Ratio 0.243 Probabilistic Sharpe Ratio 2.356% Loss Rate 0% Win Rate 100% Profit-Loss Ratio 0 Alpha 0.004 Beta -0.002 Annual Standard Deviation 0.015 Annual Variance 0 Information Ratio -0.941 Tracking Error 0.127 Treynor Ratio -1.7 Total Fees $8.24 |
namespace QuantConnect
{
public class BuyOneSecurity : QCAlgorithm
{
string _ticker = "HOME.1";
private Symbol _symbol;
private Identity _price;
public override void Initialize()
{
SetStartDate(2013, 01, 01);
SetEndDate(2018, 12, 31);
SetCash(100000);
_symbol = AddEquity(_ticker, Resolution.Daily, Market.USA).Symbol;
_price = Identity(_symbol);
PlotIndicator($"{_symbol.Value} Price", _price);
}
public override void OnData(Slice data)
{
if (!Portfolio.Invested)
{
SetHoldings(_symbol, 0.1);
Log($"Purchased Security {_symbol.ID}");
}
}
public override void OnSecuritiesChanged(SecurityChanges changes)
{
foreach (var securityChange in changes.RemovedSecurities)
{
Log(securityChange.Symbol.ID.ToString() + " - Delisted");
}
}
public override void OnEndOfAlgorithm()
{
Liquidate();
}
}
}