| Overall Statistics |
|
Total Trades 50 Average Win 0% Average Loss 0% Compounding Annual Return -99.934% Drawdown 1.000% Expectancy 0 Net Profit 0% Sharpe Ratio NaN Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha NaN Beta NaN Annual Standard Deviation NaN Annual Variance NaN Information Ratio NaN Tracking Error NaN Treynor Ratio NaN Total Fees $50.00 |
namespace QuantConnect
{
public partial class TestingAlgo : QCAlgorithm
{
private static string[] Symbols = { "AIG", "BAC", "IBM", "SPY" };
int counter;
public override void Initialize()
{
SetStartDate(2013, 10, 7);
SetEndDate(2013, 10, 7);
SetCash(25000);
foreach (var symbol in Symbols)
{
AddSecurity(SecurityType.Equity, symbol, Resolution.Minute);
}
counter = 0;
}
public void OnData(TradeBars data)
{
if (counter % 30 == 0)
{
foreach (var symbol in Symbols)
{
Buy(symbol, 10);
//LimitOrder(symbol, 10, data[symbol].High * 1.01m);
}
}
counter++;
}
public override void OnOrderEvent(OrderEvent orderEvent)
{
string orderStatusLog;
string logText;
switch (orderEvent.Status)
{
case OrderStatus.New:
orderStatusLog = " was created.";
break;
case OrderStatus.Submitted:
orderStatusLog = " was submitted.";
break;
case OrderStatus.PartiallyFilled:
orderStatusLog = string.Format(" was partially filled with {0} shares of {1}, at ${2}.",
orderEvent.FillQuantity,
Transactions.GetOrderById(orderEvent.OrderId).Quantity,
orderEvent.FillPrice
);
break;
case OrderStatus.Filled:
orderStatusLog = string.Format(" was filled at ${0}.",
orderEvent.FillPrice
);
break;
case OrderStatus.Canceled:
orderStatusLog = " was cancelled.";
break;
case OrderStatus.None:
orderStatusLog = " doesn't give a #$@!";
break;
case OrderStatus.Invalid:
orderStatusLog = " is invalid.";
break;
default:
orderStatusLog = "!";
break;
}
logText = string.Format("{0} : {1} {2} Order Id {3} of {4}",
Time,
orderEvent.Direction,
Transactions.GetOrderById(orderEvent.OrderId).Type,
orderEvent.OrderId,
orderEvent.Symbol
) + orderStatusLog;
Log(logText);
}
}
}