Overall Statistics
Total Trades
12
Average Win
0.24%
Average Loss
-0.30%
Compounding Annual Return
-67.575%
Drawdown
47.400%
Expectancy
0.360
Net Profit
-34.877%
Sharpe Ratio
-1.72
Probabilistic Sharpe Ratio
0.546%
Loss Rate
25%
Win Rate
75%
Profit-Loss Ratio
0.81
Alpha
-0.53
Beta
-0.17
Annual Standard Deviation
0.335
Annual Variance
0.112
Information Ratio
-2.345
Tracking Error
0.362
Treynor Ratio
3.384
Total Fees
$0.00
Estimated Strategy Capacity
$55000.00
# Forex ATR 

class EmotionalGreenCormorant(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2014, 10, 10)  
        self.SetEndDate(2015, 2, 25)
        self.SetCash(100000)  
        self.audusd = self.AddForex("AUDUSD", Resolution.Hour)
        
        self.SetWarmup(600)
        self.atr = self.ATR("AUDUSD", 14, MovingAverageType.Simple, Resolution.Hour)
        self.sma_atr = IndicatorExtensions.Of(SimpleMovingAverage(10), self.atr)
        
        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):
        if not self.baseline.IsReady: return
    
        self.blim = self.audusd.Close + self.atr.Current.Value
        self.slim = self.audusd.Close - self.atr.Current.Value
        
        self.bstop = self.audusd.Close - self.atr.Current.Value * 1.5
        self.sstop = self.audusd.Close + self.atr.Current.Value * 1.5
        
        self.Plot("ATR", "atr", self.atr.Current.Value)
        self.Plot("ATR", "SMA", self.sma_atr.Current.Value)
        self.Plot("Custom", "alma_fast", self.alma_fast.Current.Value)
        self.Plot("Custom", "alma_slow", self.alma_slow.Current.Value)
        self.Plot("Custom", "baseline", self.baseline.Current.Value)    
        
        if not self.Portfolio.Invested:
            if self.atr.Current.Value > self.sma_atr.Current.Value and self.alma_fast.Current.Value > self.alma_slow.Current.Value and self.audusd.Close > self.alma_fast.Current.Value and self.audusd.Close > self.alma_slow.Current.Value and self.audusd.Close > self.baseline.Current.Value:
                self.Buy("AUDUSD", 100000)
                self.LimitOrder("AUDUSD", 100000, self.blim)
                self.StopMarketOrder("AUDUSD", 100000, self.bstop)
                
        if not self.Portfolio.Invested:
            if self.atr.Current.Value > self.sma_atr.Current.Value and self.alma_fast.Current.Value < self.alma_slow.Current.Value and self.audusd.Close < self.alma_fast.Current.Value and self.audusd.Close < self.alma_slow.Current.Value and self.audusd.Close < self.baseline.Current.Value:
                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)
                
    '''