Overall Statistics |
Total Trades 274 Average Win 0.23% Average Loss -0.44% Compounding Annual Return -16.138% Drawdown 52.400% Expectancy -0.212 Net Profit -41.049% Sharpe Ratio -0.236 Loss Rate 48% Win Rate 52% Profit-Loss Ratio 0.52 Alpha 0.379 Beta -28.507 Annual Standard Deviation 0.348 Annual Variance 0.121 Information Ratio -0.282 Tracking Error 0.348 Treynor Ratio 0.003 Total Fees $0.00 |
namespace QuantConnect { public class cci_test2 : QCAlgorithm { private string my_secs = "EURUSD,AUDUSD,GBPUSD"; List<string> symbolList; List<StockDataClass> stockDatas = new List<StockDataClass>(); public override void Initialize() { SetStartDate(2012, 1, 1); SetEndDate(2015, 1, 1); SetCash(10000); symbolList = new List<string>(my_secs.Split(new char[] { ',' })); foreach (string ticker in symbolList) { AddSecurity(SecurityType.Forex, ticker, Resolution.Hour,true,50.0m,false); StockDataClass stockData = new StockDataClass(ticker); stockData.CCI = CCI(ticker, 20, MovingAverageType.Simple, Resolution.Hour); stockData.ATR = ATR(ticker, 20, MovingAverageType.Simple, Resolution.Hour); stockData.CCI_RW = new RollingWindow<decimal>(2); Debug(stockData.CCI_RW.Size); stockData.ATR_RW = new RollingWindow<decimal>(2); stockDatas.Add(stockData); } } public void OnData(TradeBars data) { for (int i = 0; i < stockDatas.Count; i++) { //This is where I am attempting to add the bars stockdata indicator values to a rolloing window. stockDatas[i].CCI_RW.Add(stockDatas[i].CCI.Current.Value); stockDatas[i].ATR_RW.Add(stockDatas[i].CCI.Current.Value); if (!stockDatas[i].CCI_RW.IsReady || !stockDatas[i].ATR_RW.IsReady) return; Debug(stockDatas[i].CCI_RW[0] + " " + stockDatas[i].CCI_RW[1]); SetHoldings("EURUSD", 5); } } } class StockDataClass { public string Ticker; public CommodityChannelIndex CCI; public AverageTrueRange ATR; public RollingWindow<decimal> CCI_RW; public RollingWindow<decimal> ATR_RW; public StockDataClass(string ticker) { Ticker = ticker; } } }