| Overall Statistics |
|
Total Trades 248 Average Win 0.00% Average Loss 0.00% Compounding Annual Return 0.391% Drawdown 0.100% Expectancy 7.648 Net Profit 0.391% Sharpe Ratio 1.44 Loss Rate 24% Win Rate 76% Profit-Loss Ratio 10.44 Alpha 0.003 Beta 0.011 Annual Standard Deviation 0.002 Annual Variance 0 Information Ratio -0.003 Tracking Error 0.141 Treynor Ratio 0.29 Total Fees $248.00 |
namespace QuantConnect
{
public class FUB_MissingTrades : QCAlgorithm
{
List<string> _symbols = new List<string>() {"AAPL", "AMZN" /*, "NFLX", "TSLA"*/};
//----------------------------------------------------------------------
// Initialize the data and resolution you require for your strategy:
public override void Initialize()
{
SetStartDate(2015, 1, 1);
SetEndDate(2015, 12, 31);
SetCash(2e6);
foreach(var symbol in _symbols)
{
AddSecurity(SecurityType.Equity, symbol, Resolution.Daily);
}
}
//----------------------------------------------------------------------
// Data Event Handler: New data arrives here.
public void OnData(TradeBars data)
{
foreach(var bar in data.Values)
{
// adjust investment to $10k
var netValue = Portfolio[bar.Symbol].Quantity * Portfolio[bar.Symbol].Price;
int deltaShares = (int)Math.Floor((10000 - netValue) / Portfolio[bar.Symbol].Price);
if (deltaShares != 0)
{
var newTicket = MarketOnOpenOrder(bar.Symbol, deltaShares);
}
}
}
}
}