| Overall Statistics |
|
Total Trades 8 Average Win 2.25% Average Loss -3.73% Compounding Annual Return -20.381% Drawdown 11.500% Expectancy -0.199 Net Profit -3.132% Sharpe Ratio -0.353 Probabilistic Sharpe Ratio 27.055% Loss Rate 50% Win Rate 50% Profit-Loss Ratio 0.60 Alpha 0.049 Beta 0.189 Annual Standard Deviation 0.302 Annual Variance 0.091 Information Ratio 1.144 Tracking Error 0.626 Treynor Ratio -0.564 Total Fees $1561.38 Estimated Strategy Capacity $2300000.00 Lowest Capacity Asset BTCUSD E3 |
namespace QuantConnect
{
public class HyperActiveFluorescentOrangeFly : QCAlgorithm
{
private string ticker = "BTCUSD";
public decimal price;
public decimal usd;
DonchianChannel donchian;
RollingWindow<decimal> upperDonchian = new RollingWindow<decimal>(3);
RollingWindow<decimal> lowerDonchian = new RollingWindow<decimal>(3);
public override void Initialize()
{
SetStartDate(2021, 04, 05);
SetEndDate(2021, 05, 25);
SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Cash);
SetCash(100000);
var _crypto = AddCrypto(ticker, Resolution.Hour, Market.Bitfinex);
donchian = DCH(ticker, 48, 48);
SetWarmUp(50);
}
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// Slice object keyed by symbol containing the stock data
public override void OnData(Slice data)
{
upperDonchian.Add(donchian.UpperBand);
lowerDonchian.Add(donchian.LowerBand);
if (!donchian.IsReady) {
return;
}
price = data[ticker].Price;
if (!Portfolio.Invested )
{
if (price > upperDonchian[1] ) {
SetHoldings(ticker, 1);
}
}
else
{
if (price < lowerDonchian[1])
{
Liquidate();
}
}
}
}
}