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
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
from clr import AddReference
AddReference("QuantConnect.Algorithm.Framework")
from QuantConnect.Algorithm.Framework.Execution import ExecutionModel

# Execution Model scaffolding structure example
class StopLossAndProfitTargetExecutionModel(ExecutionModel):

    # Fill the supplied portfolio targets efficiently
    def Execute(self, algorithm, targets):
        pass

    # Optional: Securities changes event for handling new securities.
    def OnSecuritiesChanged(self, algorithm, changes):
        pass
from Alphas.EmaCrossAlphaModel import EmaCrossAlphaModel
from Execution.StandardDeviationExecutionModel import StandardDeviationExecutionModel
from G10CurrencySelectionModel import G10CurrencySelectionModel
from MultiTimeFrameEmaAlphaModel import MultiTimeFrameEmaAlphaModel
from StopLossAndProfitTargetExecutionModel import StopLossAndProfitTargetExecutionModel
from ForexPortfolioConstructionModel import ForexPortfolioConstructionModel

class MultiTimeFrameForexScalping(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 9, 10)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
    
        
        self.AddUniverseSelection(G10CurrencySelectionModel())
        
        self.AddAlpha(MultiTimeFrameEmaAlphaModel())
        
        self.SetPortfolioConstruction(ForexPortfolioConstructionModel())
        
        self.SetExecution(StopLossAndProfitTargetExecutionModel())


    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
        '''

        # if not self.Portfolio.Invested:
        #    self.SetHoldings("SPY", 1)
from QuantConnect import *
from Selection.ManualUniverseSelectionModel import ManualUniverseSelectionModel

class G10CurrencySelectionModel(ManualUniverseSelectionModel):
    def __init__(self):
        super().__init__([Symbol.Create(x, SecurityType.Forex, Market.Oanda) for x in [ "EURUSD", "GBPUSD", "USDJPY", "AUDUSD", "NZDUSD","USDCAD", "USDCHF", "USDNOK", "USDSEK"]])
# Your New Python File
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from clr import AddReference
AddReference("QuantConnect.Common")
AddReference("QuantConnect.Algorithm")
AddReference("QuantConnect.Algorithm.Framework")
AddReference("QuantConnect.Indicators")

from QuantConnect import *
from QuantConnect.Indicators import *
from QuantConnect.Algorithm import *
from QuantConnect.Algorithm.Framework import *
from QuantConnect.Algorithm.Framework.Alphas import *


class MultiTimeFrameEmaAlphaModel(AlphaModel):
    '''Alpha model that uses an EMA cross to create insights'''

    def __init__(self,
                 barHistoryWindow = 5,
                 longLookBackPeriod = 21,
                 mediumLookBackPeriod = 13,
                 shortLookBackPeriod = 8):
        pass
       
    def Update(self, algorithm, data):
        insights = []
        
        return insights
    
    

class SymbolData:
    '''Contains data specific to a symbol required by this model'''
    def __init__(self, symbol, longLookBackPeriod, mediumLookBackPeriod, shortLookBackPeriod):
        self.Symbol = symbol
# Portfolio construction scaffolding class; basic method args.
class ForexPortfolioConstructionModel(PortfolioConstructionModel):

      # Create list of PortfolioTarget objects from Insights
      def CreateTargets(self, algorithm, insights):
            targets = []
            return targets

      # OPTIONAL: Security change details
      def OnSecuritiesChanged(self, algorithm, changes):
            # Security additions and removals are pushed here.
            # This can be used for setting up algorithm state.
            # changes.AddedSecurities:
            # changes.RemovedSecurities:
            pass