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
-0.472
Tracking Error
0.2
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
from clr import AddReference
AddReference("QuantConnect.Common")
AddReference("QuantConnect.Indicators")


from QuantConnect import *
from QuantConnect.Indicators import *



class EmotionalGreenCormorant(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2008, 6, 10)  # Set Start Date
        self.SetEndDate(2015, 2, 25)
        self.SetCash(100000)  # Set Strategy Cash
        self.audusd = self.AddForex("AUDUSD", Resolution.Hour, Market.FXCM)
        
        self.atr = self.ATR("AUDUSD", 14, MovingAverageType.Simple, Resolution.Hour)
        self.atr_str = str(self.atr)
        self.atr_float = float(self.atr_str)
        
        self.sma_atr = IndicatorExtensions.SMA(self.atr, 10)
        self.smaatrstr = str(self.sma_atr)
        self.smatr_float = float(self.smaatrstr)
        
        self.alma_fast = self.ALMA("AUDUSD", 48, Resolution.Hour)
        self.alma_slow = self.ALMA("AUDUSD", 74, Resolution.Hour)
        
        self.baseline = self.ALMA("AUDUSD", 598, Resolution.Hour)
        
        
        
        
        self.ordersize = 100000
        
    def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
            Arguments:
                data: Slice object keyed by symbol containing the stock data
        '''
        self.blim = self.audusd.Close + self.atr_float
        self.slim = self.audusd.Close - self.atr_float
        
        self.bstop = self.audusd.Close - self.atr_float * 1.5
        self.sstop = self.audusd.Close + self.atr_float * 1.5
        
        if not self.Portfolio.Invested:
            if self.atr_float > self.smatr_float and self.alma_fast > self.alma_slow and self.audusd.Close > self.alma_fast and self.audusd.Close > self.alma_slow and self.audusd.Close > self.baseline:
                self.Buy("AUDUSD", 100000)
                self.LimitOrder("AUDUSD", 100000, self.blim)
                self.StopMarketOrder("AUDUSD", 100000, self.bstop)
        if not self.Portfolio.Invested:
            if self.atr_float > self.smatr_float and self.alma_fast < self.alma_slow and self.audusd.Close < self.alma_fast and self.audusd.Close < self.alma_slow and self.audusd.Close < self.baseline:
                self.Sell("AUDUSD", 100000)
                self.LimitOrder("AUDUSD", 100000, self.slim)
                self.StopMarketOrder("AUDUSD", 100000, self.sstop)
            
    def OnOrderEvent(self, orderEvent):
        
        if order.Status == OrderStatus.Filled:
            if order.Type == OrderType.Limit or order.Type == OrderType.StopMarket:
                self.Transactions.CancelOpenOrders(order.Symbol)