Overall Statistics
Total Trades
5
Average Win
1.22%
Average Loss
0%
Compounding Annual Return
1110.055%
Drawdown
1.600%
Expectancy
0
Net Profit
2.770%
Sharpe Ratio
14.954
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
1.754
Beta
-1.202
Annual Standard Deviation
0.093
Annual Variance
0.009
Information Ratio
9.523
Tracking Error
0.113
Treynor Ratio
-1.152
Total Fees
$0.30
import numpy as np
import decimal as d
from datetime import timedelta, datetime

class FirstProject(QCAlgorithm):

    def Initialize(self):
    
        self.SetCash(100)
        self.SetStartDate(2019, 12, 23)
        self.equity = 'AMD'
        self.AddEquity(self.equity, Resolution.Minute).Symbol
        self.SetWarmUp(timedelta(minutes=1))
        self.Securities[self.equity].FeeModel = ConstantFeeModel(.06)
        self.EMAFAST = self.EMA(self.equity, 20, Resolution.Minute)
        self.EMASLOW = self.EMA(self.equity, 200, Resolution.Minute)
        
        #Consolidate Heiken Ashi
        fiveMinuteConsolidator = TradeBarConsolidator(timedelta(minutes=5))
        fiveMinuteConsolidator.DataConsolidated += self.OnDataConsolidated
        self.SubscriptionManager.AddConsolidator(self.equity, fiveMinuteConsolidator)                                                                                          
        self.RegisterIndicator(self.equity,self.EMAFAST,  fiveMinuteConsolidator)
        self.RegisterIndicator(self.equity,self.EMASLOW,  fiveMinuteConsolidator)


        
    def OnDataConsolidated(self, sender, data):
        holdings = self.Portfolio[self.equity].Quantity
        
        if self.Portfolio[self.equity].Quantity == 0 and self.EMASLOW.Current.Value < self.EMAFAST.Current.Value : ####
           self.MarketOrder(self.equity, 2)
           
        if self.Portfolio[self.equity].Quantity > 0 and self.EMAFAST.Current.Value < self.EMASLOW.Current.Value : ####
           self.MarketOrder(self.equity, -2) 
           
           
           ##
    
    
    
    #####