Overall Statistics |
Total Trades 8 Average Win 12.41% Average Loss -4.06% Compounding Annual Return -7.655% Drawdown 17.500% Expectancy 0.014 Net Profit -0.810% Sharpe Ratio 0.126 Probabilistic Sharpe Ratio 36.950% Loss Rate 75% Win Rate 25% Profit-Loss Ratio 3.06 Alpha 0.131 Beta 0.338 Annual Standard Deviation 0.491 Annual Variance 0.241 Information Ratio 0.441 Tracking Error 0.604 Treynor Ratio 0.182 Total Fees $1659.96 Estimated Strategy Capacity $450000.00 Lowest Capacity Asset BTCUSD E3 |
namespace QuantConnect { public class HyperActiveFluorescentOrangeFly : QCAlgorithm { private string ticker = "BTCUSD"; private int startingCash = 100000; int fastPeriod = 45; int mediumPeriod = 95; public decimal price; public decimal usd; //amount of USD in our cash book ExponentialMovingAverage fastMA; ExponentialMovingAverage mediumMA; public override void Initialize() { //fastPeriod = Convert.ToInt32(GetParameter("fastPeriod")); //mediumPeriod = Convert.ToInt32(GetParameter("mediumPeriod")); SetStartDate(2021, 06, 01); //SetEndDate(2015,1,1); //SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin); SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Cash); //SetCash(startingCash); //SetAccountCurrency("USDT"); SetCash(100000); //var _crypto = AddCrypto(ticker, Resolution.Hour, Market.Bitfinex, true, 1); var _crypto = AddCrypto(ticker, Resolution.Hour, Market.Bitfinex); //_crypto.BuyingPowerModel = SecurityMarginModel(3.3) fastMA = EMA(ticker, fastPeriod, Resolution.Hour); mediumMA = EMA(ticker, mediumPeriod, Resolution.Hour); SetBenchmark(ticker); SetWarmUp(200); } /// 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) { if (!mediumMA.IsReady) { return; } price = data[ticker].Price; if (!Portfolio.Invested ) { if (fastMA > mediumMA) { SetHoldings(ticker, 1); } } else { if (fastMA < mediumMA) { Liquidate(); } } Plot("MA", "FAST", fastMA); Plot("MA", "MEDIUM", mediumMA); Plot("MA", "Price", price); } } }