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
# this is incomplete attempt to conver c# file to python. coarse funciton incomplete.
from clr import AddReference
AddReference("System")
AddReference("QuantConnect.Algorithm")
AddReference("QuantConnect.Common")
AddReference("QuantConnect.Indicators")
from System import *
from QuantConnect import *
from System.Linq import *
from QuantConnect.Indicators import *
from QuantConnect.Data.Market import *
from System.Collections.Concurrent import *
from QuantConnect.Data.UniverseSelection import *
from QuantConnect.Indicators.CandlestickPatterns import *
from datetime import timedelta, datetime
import numpy as np
import sys
import decimal




class TestCandlestickAlgorithm ( QCAlgorithm):
    
    def Initialize(self):
        self.SetCash(100000)
        self.SetStartDate(2009,7,1)
        self.SetEndDate(2009,9,11)
        self.SetBrokerageModel(BrokerageName.OandaBrokerage)
        
        self.security= self.AddForex("EURUSD", Resolution.Daily, Market.Oanda)
        #self.security = self.AddEquity("SPY", Resolution.Daily)
        self.symbol = self.security.Symbol
        periods = decimal.Decimal(10)
        self.pattern = Doji(self.symbol)
        self.SetWarmUp(timedelta(days=10))
        


    def OnData(self,slice):
        self.Log("Time: {}" . format(slice.Time) )
        
        if (self.IsWarmingUp): return
        if slice is None:
            self.Log("no slice " )
            return
            
            
        self.Log("slice data is open {} close {} " . format(slice[self.symbol].Open, slice[self.symbol].Close) )
        self.Log("self pattern is {} " . format(self.pattern))
        if self.pattern is None: 
            self.Log("pattern not yet defined. skipping")
            return
            
        if (self.pattern == 1):
            self.Log("Time: {} pattern is 1 going long" . format(slice.Time) )
            self.SetHoldings(self.symbol, 1)
        elif (self.pattern == -1):    
            self.Log("pattern is -1 going short")
            self.SetHoldings(self.symbol, -1);
        else:
            self.Log("no doji recognized skipping")