Overall Statistics |
Total Trades 3 Average Win 0% Average Loss -0.15% Compounding Annual Return -96.651% Drawdown 4.000% Expectancy -1 Net Profit -1.844% Sharpe Ratio -2.907 Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.245 Beta -133.37 Annual Standard Deviation 0.506 Annual Variance 0.256 Information Ratio -2.925 Tracking Error 0.506 Treynor Ratio 0.011 Total Fees $0.00 |
namespace QuantConnect.Algorithm.CSharp{ public class BasicTemplateAlgorithm : QCAlgorithm { String symbol = "EURUSD"; decimal open; decimal close; decimal low; decimal high; int size = 10; // TimeFrame tf = new TimeFrame(15); public override void Initialize(){ //SetTimeZone(TimeZones.Berlin); AddSecurity(SecurityType.Forex, symbol, Resolution.Daily); //SetTimeZone(TimeZones.NewYork); SetStartDate(2018, 02, 21); //Set Start Date SetEndDate(2018, 02, 22); //Set End Date SetCash(100000); //Set Strategy Cash } public override void OnData(Slice data){ close = data[symbol].Close; open = data[symbol].Open; high = data[symbol].High; low = data[symbol].Low; Debug("Close: "+close.ToString("G")); Debug("Open: "+open.ToString("G")); Debug("High: "+high.ToString("G")); Debug("Low: "+low.ToString("G")); Debug("Time : "+Time.ToString()); Debug("--------------------------"); SetHoldings(symbol, size); /* //Debug(close.ToString("G")); //Debug("Time : "+Time.ToString()); //Debug(tf.getCount()); //Debug("--------------------------"); if(tf.isReady(open, close, high, low) == false){ return; } else { Debug("Close: "+close.ToString("G")); Debug("Open: "+open.ToString("G")); Debug("High: "+high.ToString("G")); Debug("Low: "+low.ToString("G")); Debug("Time : "+Time.ToString()); Debug("--------------------------"); SetHoldings(symbol, size); } */ } } }
namespace QuantConnect { public class TimeFrame { private decimal open; private decimal close; private decimal high; private decimal low; private int timeFrame; private int count = 0; public TimeFrame(int n){ timeFrame = n; } public bool isReady(decimal openPrice, decimal closePrice, decimal highPrice, decimal lowPrice){ if(count == 0){ open = openPrice; high = highPrice; low = lowPrice; count++; return false; } else { if(highPrice > high){ high = highPrice; } if(low < lowPrice){ low = lowPrice; } count++; if(count == timeFrame){ count = 0; close = closePrice; return true; } else return false; } } public decimal getOpen(){ return open; } public decimal getClose(){ return close; } public decimal getLow(){ return low; } public decimal getHigh(){ return high; } public String getCount(){ int temp = 1+count; return temp.ToString(); } } }