Overall Statistics
Total Trades
85
Average Win
0.00%
Average Loss
0.00%
Compounding Annual Return
-0.021%
Drawdown
0.000%
Expectancy
0.404
Net Profit
-0.002%
Sharpe Ratio
-0.324
Probabilistic Sharpe Ratio
30.167%
Loss Rate
33%
Win Rate
67%
Profit-Loss Ratio
1.11
Alpha
-0
Beta
0.002
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-0.721
Tracking Error
0.154
Treynor Ratio
-0.074
Total Fees
$182.75
Estimated Strategy Capacity
$860000000000.00
Lowest Capacity Asset
ES XKGCMV4QK9VL
#region imports
from datetime import datetime, timedelta
import datetime
from AlgorithmImports import *
import pandas as pd
from QuantConnect.Python import *
from QuantConnect.Indicators import RollingWindow
#endregion
class RetrospectiveTanButterfly(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 9, 17)  # Set Start Date
        self.SetEndDate(2020, 10, 26)
        self.SetCash(1000000000)  # Set Strategy Cash
        self.symbolData = {}

        self.canLong = True
        self.canShort = True

        self.contract = self.AddFuture(Futures.Indices.SP500EMini , Resolution.Second, extendedMarketHours = False, dataNormalizationMode = DataNormalizationMode.BackwardsRatio, dataMappingMode = DataMappingMode.OpenInterest , contractDepthOffset = 0)
        symbol = self.contract.Symbol
        self.log1 = True



    def OnData(self, data):
        def l():
            self.MarketOrder(self.contract.Mapped, 1)

        def s():
            self.MarketOrder(self.contract.Mapped, -1)

        sT = self.Time.strftime('%y/%m/%d %H:%M:%S')

        if sT == '20/09/17 11:41:05':
            s()
        if sT == '20/09/17 12:26:00':
            s()
        if sT == '20/09/17 13:07:51':
            s()
        if sT == '20/09/17 13:36:50':
            l()
        if sT == '20/09/17 13:43:13':
            l()
        if sT == '20/09/18 09:46:23':
            s()
        if sT == '20/09/18 12:23:48':
            s()
        if sT == '20/09/18 12:24:54':
            l()
        if sT == '20/09/18 12:42:38':
            s()
        if sT == '20/09/18 13:28:39':
            s()
        if sT == '20/09/21 09:37:01':
            s()
        if sT == '20/09/21 09:46:16':
            l()
        if sT == '20/09/21 11:14:46':
            s()
        if sT == '20/09/21 13:15:27':
            l()
        if sT == '20/09/21 13:44:58':
            s()
        if sT == '20/09/21 14:48:13':
            s()
        if sT == '20/09/21 14:54:21':
            l()
        if sT == '20/09/21 15:18:19':
            l()
        if sT == '20/09/21 15:38:03':
            l()
        if sT == '20/09/22 10:32:19':
            s()
        if sT == '20/09/23 09:35:30':
            l()
        if sT == '20/09/23 11:50:01':
            s()
        if sT == '20/09/24 09:50:03':
            l()
        if sT == '20/09/24 10:53:46':
            l()
        if sT == '20/09/24 12:02:46':
            l()
        if sT == '20/09/24 12:43:21':
            l()
        if sT == '20/09/24 13:07:17':
            l()
        if sT == '20/09/24 15:21:44':
            s()
        if sT == '20/09/24 15:32:46':
            s()
        if sT == '20/09/25 13:44:57':
            l()
        if sT == '20/09/25 14:18:24':
            l()
        if sT == '20/09/25 14:52:05':
            l()
        if sT == '20/09/25 15:19:54':
            l()
        if sT == '20/09/28 10:13:54':
            l()
        if sT == '20/09/28 13:22:11':
            l()
        if sT == '20/09/28 13:33:14':
            l()
        if sT == '20/09/28 14:16:26':
            l()
        if sT == '20/09/29 10:36:35':
            s()
        if sT == '20/09/29 10:40:57':
            l()
        if sT == '20/09/29 11:43:49':
            s()
        if sT == '20/09/29 11:52:20':
            l()
        if sT == '20/09/29 12:53:43':
            l()
        if sT == '20/09/29 13:47:44':
            l()
        if sT == '20/09/29 14:33:12':
            l()
        if sT == '20/09/30 10:03:13':
            l()
        if sT == '20/09/30 10:40:10':
            l()
        if sT == '20/09/30 12:21:01':
            l()
        if sT == '20/10/01 14:51:40':
            l()
        if sT == '20/10/05 10:31:42':
            l()
        if sT == '20/10/05 10:43:42':
            l()
        if sT == '20/10/05 11:20:25':
            l()
        if sT == '20/10/06 14:25:57':
            l()
        if sT == '20/10/06 14:52:45':
            s()
        if sT == '20/10/08 12:08:30':
            l()
        if sT == '20/10/12 10:53:05':
            l()
        if sT == '20/10/12 11:05:18':
            l()
        if sT == '20/10/12 11:11:40':
            l()
        if sT == '20/10/13 13:16:52':
            l()
        if sT == '20/10/14 09:49:17':
            l()
        if sT == '20/10/14 10:05:28':
            s()
        if sT == '20/10/14 15:08:14':
            l()
        if sT == '20/10/15 09:32:26':
            l()
        if sT == '20/10/15 10:52:31':
            l()
        if sT == '20/10/15 11:19:31':
            l()
        if sT == '20/10/15 13:36:04':
            l()
        if sT == '20/10/15 15:19:33':
            l()
        if sT == '20/10/15 15:42:07':
            l()
        if sT == '20/10/16 10:00:35':
            l()
        if sT == '20/10/16 10:26:29':
            l()
        if sT == '20/10/16 15:41:39':
            s()
        if sT == '20/10/19 09:39:59':
            l()
        if sT == '20/10/19 14:42:38':
            s()
        if sT == '20/10/20 12:34:24':
            l()
        if sT == '20/10/21 11:15:14':
            s()
        if sT == '20/10/21 11:22:14':
            s()
        if sT == '20/10/22 15:38:11':
            l()
        if sT == '20/10/23 09:30:11':
            l()
        if sT == '20/10/23 14:05:02':
            l()
        if sT == '20/10/23 15:13:23':
            l()
        if sT == '20/10/23 15:44:17':
            l()
        if sT == '20/10/26 10:31:47':
            s()
        if sT == '20/10/26 11:55:45':
            l()
        if sT == '20/10/26 12:34:01':
            s()
        if sT == '20/10/26 13:16:47':
            s()
        if sT == '20/10/26 13:35:05':
            s()