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
from datetime import datetime, timedelta

class WhoItsWhatsIts(QCAlgorithm):

    def Initialize(self):
        
        # set cash, dates, and brokerage fees
        self.SetCash(100000)
        self.SetStartDate(2017,3,1)
        self.SetEndDate(2017,5,1)
        self.SetBrokerageModel(BrokerageName.OandaBrokerage)
        
        # holds symbol data
        self.Data = {}
        self.SymbolData = {}
        
        # resolution designations
        self.PR = Resolution.Hour
        self.IR = Resolution.Hour
            
        # initialize forex pairs
        self.pairs =["USDJPY", "AUDUSD", "NZDUSD", "USDCAD", "EURUSD", "EURJPY"]
        for symbol in self.pairs:
            if symbol not in self.Data:
                fx = self.AddForex(symbol, self.PR, Market.Oanda)
                self.Data[symbol]= fx
            else:
                break
            
        # initialize indicators for all pairs
        for symbol in self.Data.items():
            macd = self.MACD(fx.Symbol, 11, 25, 8, self.IR)
            sma = self.SMA(fx.Symbol, 18, self.IR)
            rsi = self.RSI(fx.Symbol, 14, self.IR)
            self.SymbolData[symbol] = SymbolData(symbol,macd,sma,rsi)
            
    def OnEndOfDay(self):
        
        
        for fx in self.SymbolData:
            self.Debug(self.SymbolData[fx].Symbol)
            self.Debug(self.SymbolData[fx].MACD.Current.Value)
            self.Debug(self.SymbolData[fx].SMA.Current.Value)
            self.Debug(self.SymbolData[fx].RSI.Current.Value)
        
        for fx in self.Data.items():
            self.PlotIndicator("macd", self.SymbolData[fx].MACD)
        
            
class SymbolData(object):
    
    def __init__(self, symbol, macd, sma, rsi):
        self.Symbol = symbol
        self.MACD = macd
        self.SMA = sma
        self.RSI = rsi
"""The reason why you can't produce any more indicators than the final pair in the list, 
is because the code keeps on overriding self.macd, self.sma and self.rsi. 
In order to save the objects once created, try creating a SymbolData object like so:

class SymbolData(object):
    def __init__(self, symbol, macd, sma, rsi):
        self.Symbol = symbol
        self.MACD = macd
        self.SMA = sma
        self.RSI = rsi
        
This SymbolData object can be stored in a dictionary that is keyed by the symbol 
just like self.Data in the above code. This way the indicators for each symbol will be properly stored.
The backtest below shows a possible implementation."""