| 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 |
namespace QuantConnect
{
/*
* OANDA/QuantConnect Basic Template:
* Fundamentals to using a QuantConnect algorithm.
*
* You can view the QCAlgorithm base class on Github:
* https://github.com/QuantConnect/Lean/tree/master/Algorithm
*/
public class BasicTemplateAlgorithm : QCAlgorithm
{
private RollingWindow<IndicatorDataPoint> BBWIN;
BollingerBands Bol;
//Initialize the data and resolution you require for your strategy:
public override void Initialize()
{
// Date range for your backtest
// In live trading these are ignored.
SetStartDate(2016, 1, 1);
SetEndDate(2016, 6, 1);
// Set cash allocation for backtest
// In live trading this is ignored and your real account is used.
SetCash(5000);
// Specify the OANDA Brokerage: This gives lets us know the fee models & data.
SetBrokerageModel(BrokerageName.OandaBrokerage);
//Add as many securities as you like. All the data will be passed into the event handler:
AddForex("GBPUSD", Resolution.Minute, Market.Oanda);
Bol = BB("GBPUSD", 20, 20, MovingAverageType.Simple);
BB("GBPUSD", 20, 20).Updated += (sender, updated) => BBWIN.Add(updated);
BBWIN = new RollingWindow<IndicatorDataPoint>(5);
}
// Event handler for the price events
public override void OnData(Slice data)
{ if (!BBWIN.IsReady) return;
var bbpast1 = BBWIN[1];
if (!Portfolio.HoldStock)
{
}
Plot("PAST", "Bollinger", Bol.MiddleBand);
Plot("PAST", "BB Past", bbpast1);
}
}
}