Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
-6.795%
Drawdown
13.700%
Expectancy
0
Net Profit
-10.179%
Sharpe Ratio
-0.879
Probabilistic Sharpe Ratio
0.246%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.009
Beta
0.9
Annual Standard Deviation
0.053
Annual Variance
0.003
Information Ratio
-0.221
Tracking Error
0.024
Treynor Ratio
-0.051
Total Fees
$0.00
Estimated Strategy Capacity
$580000.00
Lowest Capacity Asset
EURUSD 8G
financial_instrument = "EURUSD"; period = 30; SL = 0.01; TP = 0.01;

class MeasuredSkyBlueWolf(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 10, 18)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        
        res = Resolution.Daily
        
        self.financial_instrument = self.AddForex(financial_instrument, Resolution.Daily).Symbol
        
        self.macd = self.MACD(financial_instrument, 12, 26, 9, MovingAverageType.Exponential, Resolution.Daily)
        self.psar = self.PSAR(financial_instrument, 0.02, 0.02, 0.2, Resolution.Daily)
        self.ema = self.EMA(financial_instrument, 20, Resolution.Daily)
        
        self.SetWarmUp(period, res)
        self.SetBenchmark(financial_instrument)
        self.__previous = datetime.min
        self.PlotIndicator("MACD", True, self.macd, self.macd.Signal)

    def OnData(self, data: Slice):
        
        price = self.Securities[financial_instrument].Price
        
        if not self.psar.IsReady: 
            return
        if not self.macd.IsReady: 
            return
        if not self.ema.IsReady: 
            return
        
        uptrend = price > self.ema.Current.Value
        downtrend = price < self.ema.Current.Value
    
        if not self.Portfolio.Invested:
            if uptrend is True:
                if self.macd.Current.Value > self.macd.Signal.Current.Value and self.psar.Current.Value < price:
                    self.SetHoldings(financial_instrument, 1)
            elif downtrend is True:
                if self.macd.Current.Value < self.macd.Signal.Current.Value and self.psar.Current.Value > price:
                    self.SetHoldings(financial_instrument, -1)
                
        elif self.Portfolio.Invested:
            if price >= price*(1 + TP) or price < price*(1 - SL):
                self.Liquidate(financial_instrument.Symbol)