| Overall Statistics |
|
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 |
using System.Drawing;
using System.Collections.Generic;
namespace QuantConnect.Algorithm.CSharp
{
public class MA_Crypto_MultiSymbol : QCAlgorithm
{
List<string> symbolList = new List<string>(){"ETHUSD", "LTCUSD", "BTCUSD"};
/// List of a new class with data for each symbol: e.g. indicators
Dictionary<string, SymbolData> DataDict = new Dictionary<string, SymbolData>();
/// <summary>
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
/// </summary>
public override void Initialize()
{
SetStartDate(2017, 10, 01); //Set Start delegate
SetEndDate(2018, 01, 31); //Set End Date
SetCash(10000); //Set Strategy Cash
SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);
/// Add symbols and register their indicators
foreach (var symbol in symbolList)
{
AddCrypto(symbol, Resolution.Hour);
var _slowEMA = EMA(symbol, 200);
/// Add the data to the SymbolData List
DataDict.Add(symbol, new SymbolData
{
slowEMA = _slowEMA,
});
}
/// Set warm up for indicators
SetWarmup(200);
}
/// Event handler
public override void OnData(Slice data)
{
/// check if algorithm is warming up
if (IsWarmingUp) return;
/// check if all indicators are ready
foreach (var symbol in symbolList)
{
if (!DataDict[symbol].slowEMA.IsReady)
{
Log("Indicator not ready");
return;
}
}
}
/// Class for storing data for each symbol in the SymbolDataDict
class SymbolData
{
public ExponentialMovingAverage slowEMA { get; set; }
}
}
}