| 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 Probabilistic 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 -6.895 Tracking Error 0.055 Treynor Ratio 0 Total Fees $0.00 |
import numpy as np
### <summary>
### Basic template algorithm simply initializes the date range and cash. This is a skeleton
### framework you can use for designing an algorithm.
### </summary>
class BasicTemplateAlgorithm(QCAlgorithm):
'''Basic template algorithm simply initializes the date range and cash'''
def Initialize(self):
self.SetStartDate(2017,1, 1) #Set Start Date
self.SetEndDate(2017,2, 15) #Set End Date
self.SetCash(5000) #Set Strategy Cash
self.AddForex("EURGBP", Resolution.Hour, Market.Oanda)
self.SetBrokerageModel(BrokerageName.OandaBrokerage)
self.numATRs = 1.5;
length = 5;
self.atr = self.ATR("EURGBP", length, MovingAverageType.Simple, Resolution.Hour)
self.AutomaticIndicatorWarmUp = True
self.past_bar = None
def OnData(self, data):
if self.IsWarmingUp or not self.atr.IsReady or not data.ContainsKey('EURGBP'):
return
bar = data['EURGBP']
if self.past_bar is None:
self.past_bar = bar
return
close = bar.Close
low = self.past_bar.Low
self.past_bar = bar
condition = low <= close - self.atr.Current.Value * self.numATRs
self.Log(str(condition))