[Backtest] Cryptocurrency Trend Following Backtest with Chandelier Exit


개요

Chandelier Exit (샹들리에 청산) 전략을 추가해 봅니다.

이전 포스팅에서 테스트한 추세 추종 전략은 청산가가 최근 20개 4시간봉 기준으로 만든 고가-저가 채널의 하단 20%로 정해지기 때문에 상승 추세에 있다면 청산가도 따라 올라가게 되어 있습니다. 그러나, 최고가에 도달한 후 추세가 애매하게 흐르면서 가격이 약간씩 내려온다면 수익을 오히려 깎아먹을 수 있습니다. 이런 것을 완화하기 위하여 채널 청산, 손절 외에 많이 사용하는 Chandelier (샹들리에) 청산을 추가해 보겠습니다. Chandelier 청산은 채널과 별개로 최근 고점 대비 일정 수준 하락 시 청산하는 것으로, 추세 추종 트레이딩 전략에서 많이 쓰입니다.

Chandelier 청산을 위해서는 ATR 지표가 필요합니다. ATR 지표를 계산하려면 TR 지표가 필요합니다. TR은 True Range의 줄임말로, 현재 봉의 고가와 저가 차이, 현재 봉의 고가와 이전 봉 종가의 차이, 현재 봉의 저가와 이전 봉 종가의 차이 중 가장 큰 값입니다. ATR은 TR을 평균낸 것으로, 단순 이동평균, 지수 이동평균, 또는 지표를 처음 만든 사람이 적용한 특이한 이동평균 모두 사용 가능합니다. 저는 최근의 값에 조금 더 힘을 실어주기 위해 지수 이동평균을 사용하겠습니다.

이전 포스팅에 사용한 전략과 같은 전략인데, Chandelier 청산만 추가한 전략입니다. Chandelier 청산 전략대로, num_candle 기간 동안의 최고가에서 atr_candle 기간 동안의 데이터로 구한 ATR 값의 atr_mul 배수만큼 하락하면 청산합니다. 민첩한 청산을 원하는 것이므로, ATR 계산 기간인 atr_candle은 num_candle보다 작게 가져가는 것으로 가정하고 backtester_chandelier 함수를 만들었습니다.

# crypto: 암호화폐 티커
# interval: 캔들 종류
# num_candle: 거래 시그널 만들 때 사용할 캔들 수
# atr_candle: 샹들리에 청산 위한 atr 계산 시 사용할 캔들 수. 민첩한 움직임이 필요하니 num_candle보다는 짧게 가져갈 생각
# atr_mul: 고점 대비 몇 atr 하락 시 탈출할 것인지
# range_up: 채널 상단 범위
# range_down: 채널 하단 범위
# begin: 시작 시간
# end: 끝 시간

# 샹들리에 청산 추가 버전
def backtester_chandelier(crypto, interval, num_candle, atr_candle, atr_mul, range_up, range_down, begin, end):
    # 2017-09-26 17:00:00 -> 1506412800
    starttime = int(timelibrary.mktime(datetime.datetime.strptime(begin, '%Y-%m-%d %H:%M:%S').timetuple()))
    # 2021-04-08 01:00:00 -> 1617811200
    endtime = int(timelibrary.mktime(datetime.datetime.strptime(end, '%Y-%m-%d %H:%M:%S').timetuple()))
    # 봉 총 개수
    total_candle = (endtime - starttime) / 14400
    
    df_total = pd.DataFrame(columns=['open', 'high', 'low', 'close', 'volume'])
    
    # 봉 200개씩 가져올 수 있음 -> total_candle // 200 + 1
    num_chunk = int(total_candle // 200)
    
    for i in range(num_chunk + 1):
        df = pyupbit.get_ohlcv(crypto, interval=interval, to=datetime.datetime.fromtimestamp(starttime + (i+1) * 200 * 14400).strftime('%Y-%m-%d %H:%M:%S'))
        df_total = pd.concat([df_total, df])
    
    df_total['high_candle'] = df_total['high'].shift(1).rolling(window=num_candle).max()
    df_total['low_candle'] = df_total['low'].shift(1).rolling(window=num_candle).min()
    
    df_total['high_low_up'] = df_total['low_candle'] + range_up * (df_total['high_candle'] - df_total['low_candle'])
    df_total['high_low_down'] = df_total['low_candle'] + range_down * (df_total['high_candle'] - df_total['low_candle'])
    
    # 이전 봉 종가
    df_total['prev_close'] = df_total['close'].shift(1)
    
    # tr = max(abs(high - low), abs(high - prev_close), abs(low - prev_close))
    df_total['hml'] = df_total['high'] - df_total['low']
    df_total['hmprevc'] = abs(df_total['high'] - df_total['prev_close'])
    df_total['lmprevc'] = abs(df_total['low'] - df_total['prev_close'])
    df_total['tr'] = df_total.loc[:, ['hml','hmprevc','lmprevc']].max(axis=1)
    
    # atr(10) = exponential moving average(10) of tr
    df_total['atr'] = df_total['tr'].ewm(atr_candle).mean()
    
    long = 0
    entry_price = 0
    exit_price = 0
    stop_loss_price = 0
    budget = 1000000
    position_size = 0
    win = 0
    lose = 0
    gross_profit = 0
    gross_loss = 0
    timestamp_budget = []
    labels = ['Date', 'Budget']
    
    # start point for graph
    timestamp_budget.append([df_total.index[num_candle], budget])
    
    for i in range(len(df_total)):
        
        # ATR 구하는 과정에서 prev_close 구할 때 맨 위가 null인 것이나 atr이 atr_candle 만큼 지나기 전까지는 완전한 값이 아님
        # num_candle 만큼은 통과하고 시작하기 때문에 atr_candle < num_candle이기만 하면 괜찮음
        if i >= num_candle:
            # long
            # low < high_low_up < high -> enter long position
            if df_total.iloc[i,7] < df_total.iloc[i,1] and df_total.iloc[i,7] > df_total.iloc[i,2]:
                # long signal on, no long position yet
                # long position activated and long signal on -> pass
                if long == 0:
                    # long state activate
                    long = 1
                    entry_price = df_total.iloc[i,7]
                    # 손절선 조절 가능
                    # 실거래를 5개 암호화폐 동일 비중으로 할 생각이라 1회 거래에서 총 자금의 2% 이상 잃지 않도록 10% 손절선 설정
                    stop_loss_price = entry_price * (1 - 0.1)
                    position_size = budget / entry_price
                    print("Date: ", df_total.index[i], "Long Entry: ", entry_price, "Size: ", position_size)
                    
            # stop loss on
            if long == 1 and stop_loss_price < df_total.iloc[i,1] and stop_loss_price > df_total.iloc[i,2]:
                exit_price = stop_loss_price
                # 슬리피지 1% 가정 (실제보다 보수적으로)
                pnl = (exit_price - entry_price) * position_size * (1 + 0.01)
                budget += pnl
                # graph point
                timestamp_budget.append([df_total.index[i], budget])
                gross_loss += pnl
                lose += 1
                print("Date: ", df_total.index[i], "Long stop loss ", "Profit or Loss: ", pnl)
                long = 0
                exit_price = 0
                entry_price = 0
                stop_loss_price = 0
                position_size = 0    
            
            # long position close rule 1 on: 20% channel below breakout
            # low < high_low_down < high --> close long position
            if long == 1 and df_total.iloc[i,8] < df_total.iloc[i,1] and df_total.iloc[i,8] > df_total.iloc[i,2]:
                exit_price = df_total.iloc[i,8]
                # 슬리피지 1% 가정 (실제보다 보수적으로)
                pnl = (exit_price - entry_price) * position_size * (1 - 0.01)
                budget += pnl
                # graph point
                timestamp_budget.append([df_total.index[i], budget])
                
                if pnl > 0:
                    gross_profit += pnl
                    win += 1
                if pnl < 0:
                    gross_loss += pnl
                    lose += 1
                
                print("Date: ", df_total.index[i], "Long close ", "Profit or Loss: ", pnl)
                long = 0
                exit_price = 0
                entry_price = 0
                stop_loss_price = 0
                position_size = 0
            
            # long position close rule 2 on: highest - atr_mul * atr 밑으로 갈 때
            # num_candle 동안 고가: index 5, atr: index 14
            # low < highest - 3 * atr < high --> close long position by chandelier exit
            if long == 1 and (df_total.iloc[i,5] - atr_mul * df_total.iloc[i,14]) < df_total.iloc[i,1] and (df_total.iloc[i,5] - atr_mul * df_total.iloc[i,14]) > df_total.iloc[i,2]:
                exit_price = df_total.iloc[i,5] - atr_mul * df_total.iloc[i,14]
                # 슬리피지 1% 가정 (실제보다 보수적)
                # ATR이 어느 정도인지에 따라 수익 구간 -> 손실 구간으로 간 상태에서 청산이 나올 수도 있음
                if exit_price >= entry_price:
                    pnl = (exit_price - entry_price) * position_size * (1 - 0.01)
                elif exit_price < entry_price:
                    pnl = (exit_price - entry_price) * position_size * (1 + 0.01)
                    
                budget += pnl
                # graph point
                timestamp_budget.append([df_total.index[i], budget])
                
                if pnl > 0:
                    gross_profit += pnl
                    win += 1
                if pnl < 0:
                    gross_loss += pnl
                    lose += 1
                
                print("Date: ", df_total.index[i], "Long close ", "Profit or Loss: ", pnl)
                long = 0
                exit_price = 0
                entry_price = 0
                stop_loss_price = 0
                position_size = 0
                
    df_timestamp_budget = pd.DataFrame.from_records(timestamp_budget, columns=labels)
    df_timestamp_budget = df_timestamp_budget.set_index('Date')
    
    df_timestamp_budget.plot(title='Trend Following Strategy')
    
    return budget, (str(budget/1000000 * 100) + str('%')), win+lose, win/(win+lose), (gross_profit/win)/abs(gross_loss/lose)

테스트 출력 예시입니다. KRW-ETH (원화 마켓, 이더리움) 대상으로 4시간봉 20개를 사용하고, 채널 상하단은 80 - 20, 2017년 9월 26일 오후 5시부터 2021년 4월 8일 오전 1시까지입니다. Chandelier Exit은 10개 캔들 기준으로 ATR을 계산하고, 20개 캔들에서의 고점 대비 3ATR 하락 시 청산하도록 합니다.

Date:  2017-10-01 01:00:00 Long Entry:  339700.0 Size:  2.943773918163085
Date:  2017-10-03 17:00:00 Long close  Profit or Loss:  -25937.59199293494
Date:  2017-10-04 17:00:00 Long Entry:  341600.0 Size:  2.8514707494352023
Date:  2017-10-10 01:00:00 Long close  Profit or Loss:  -3387.5472503290202
Date:  2017-10-11 13:00:00 Long Entry:  352400.0 Size:  2.7544689578795007
Date:  2017-10-17 09:00:00 Long close  Profit or Loss:  48266.559548922494
Date:  2017-10-24 21:00:00 Long Entry:  362500.0 Size:  2.8108728836018164
Date:  2017-10-25 09:00:00 Long close  Profit or Loss:  -60942.534989370986
Date:  2017-10-29 17:00:00 Long Entry:  346900.0 Size:  2.7615995540971103
Date:  2017-10-29 13:00:00 Long close  Profit or Loss:  -15583.706283769992
Date:  2017-10-29 21:00:00 Long Entry:  355300.0 Size:  2.652449138847502
Date:  2017-10-30 05:00:00 Long close  Profit or Loss:  -31773.688234254227
Date:  2017-10-31 09:00:00 Long Entry:  355300.0 Size:  2.563021364475832
Date:  2017-11-01 09:00:00 Long close  Profit or Loss:  -16239.303365318872
Date:  2017-11-06 21:00:00 Long Entry:  346700.0 Size:  2.579758256224241
Date:  2017-11-06 21:00:00 Long stop loss  Profit or Loss:  -90334.62093072738
Date:  2017-11-07 13:00:00 Long Entry:  341060.0 Size:  2.3575545842438776
Date:  2017-11-11 01:00:00 Long close  Profit or Loss:  -163.3785326881007
Date:  2017-11-13 01:00:00 Long Entry:  365760.0 Size:  2.1979007763821325
Date:  2017-11-13 21:00:00 Long close  Profit or Loss:  -13814.848816394806
Date:  2017-11-19 05:00:00 Long Entry:  377530.0 Size:  2.092785577710736
Date:  2017-11-20 01:00:00 Long close  Profit or Loss:  11162.70372226606
Date:  2017-11-21 05:00:00 Long Entry:  404630.0 Size:  1.9802091858621458
Date:  2017-11-21 09:00:00 Long close  Profit or Loss:  -45622.71318896826
Date:  2017-11-21 21:00:00 Long Entry:  405160.0 Size:  1.8650146354191721
Date:  2017-11-29 13:00:00 Long close  Profit or Loss:  247038.31774021208
Date:  2017-11-29 17:00:00 Long Entry:  582600.0 Size:  1.721022395171033
Date:  2017-11-30 01:00:00 Long close  Profit or Loss:  -61644.890442205855
Date:  2017-12-04 05:00:00 Long Entry:  535290.0 Size:  1.7579681237916607
Date:  2017-12-07 01:00:00 Long close  Profit or Loss:  13662.04927404689
Date:  2017-12-07 05:00:00 Long Entry:  561480.0 Size:  1.7003006451850198
Date:  2017-12-08 17:00:00 Long close  Profit or Loss:  -65783.27172169226
Date:  2017-12-08 21:00:00 Long Entry:  580600.0 Size:  1.53100505431759
Date:  2017-12-10 01:00:00 Long stop loss  Profit or Loss:  -89779.05498821607
Date:  2017-12-12 05:00:00 Long Entry:  566080.0 Size:  1.411677641938554
Date:  2017-12-22 09:00:00 Long close  Profit or Loss:  544007.265670741
Date:  2017-12-26 17:00:00 Long Entry:  1031560.0 Size:  1.3020374435023825
Date:  2017-12-28 09:00:00 Long stop loss  Profit or Loss:  -135656.10426715107
Date:  2017-12-30 21:00:00 Long Entry:  1018000.0 Size:  1.1861234194029142
Date:  2018-01-08 21:00:00 Long close  Profit or Loss:  801436.1938890654
Date:  2018-01-09 01:00:00 Long Entry:  1936800.0 Size:  1.0372314306284758
Date:  2018-01-11 01:00:00 Long close  Profit or Loss:  -25505.647644368295
Date:  2018-01-14 09:00:00 Long Entry:  1950000.0 Size:  1.0171303524086481
Date:  2018-01-16 05:00:00 Long close  Profit or Loss:  -131508.85178432375
Date:  2018-01-20 09:00:00 Long Entry:  1399800.0 Size:  1.3229713783487214
Date:  2018-01-21 13:00:00 Long stop loss  Profit or Loss:  -187041.42887666658
Date:  2018-01-25 09:00:00 Long Entry:  1304700.0 Size:  1.2760434632757518
Date:  2018-01-26 17:00:00 Long stop loss  Profit or Loss:  -168150.2445601232
Date:  2018-01-27 01:00:00 Long Entry:  1268000.0 Size:  1.1803656640187306
Date:  2018-01-30 21:00:00 Long close  Profit or Loss:  21134.800466785466
Date:  2018-02-08 09:00:00 Long Entry:  884820.0 Size:  1.715420608081345
Date:  2018-02-11 09:00:00 Long close  Profit or Loss:  29823.45322958653
Date:  2018-02-14 09:00:00 Long Entry:  980060.0 Size:  1.579150170063182
Date:  2018-02-18 17:00:00 Long close  Profit or Loss:  76667.10909649947
Date:  2018-02-20 13:00:00 Long Entry:  1099600.0 Size:  1.4771999133945268
Date:  2018-02-21 09:00:00 Long close  Profit or Loss:  -87306.94648135672
Date:  2018-02-28 09:00:00 Long Entry:  991880.0 Size:  1.549604869830287
Date:  2018-03-01 09:00:00 Long close  Profit or Loss:  -36020.87512017898
Date:  2018-03-12 17:00:00 Long Entry:  813120.0 Size:  1.8459774733951766
Date:  2018-03-13 01:00:00 Long close  Profit or Loss:  -95546.56364711348
Date:  2018-03-21 05:00:00 Long Entry:  626480.0 Size:  2.243415016472948
Date:  2018-03-22 21:00:00 Long close  Profit or Loss:  -85507.76335286642
Date:  2018-04-03 21:00:00 Long Entry:  443330.0 Size:  2.977346166889464
Date:  2018-04-05 01:00:00 Long close  Profit or Loss:  -100836.2578321887
Date:  2018-04-08 05:00:00 Long Entry:  423520.0 Size:  2.8785195937261934
Date:  2018-04-09 21:00:00 Long close  Profit or Loss:  21441.723025257445
Date:  2018-04-12 05:00:00 Long Entry:  457880.0 Size:  2.709339436883408
Date:  2018-04-20 13:00:00 Long close  Profit or Loss:  369760.86844275164
Date:  2018-04-20 17:00:00 Long Entry:  624020.0 Size:  2.5805474340612906
Date:  2018-04-25 13:00:00 Long close  Profit or Loss:  193626.08061598166
Date:  2018-04-29 17:00:00 Long Entry:  731540.0 Size:  2.46594757691843
Date:  2018-05-01 09:00:00 Long close  Profit or Loss:  -29832.540596043782
Date:  2018-05-03 09:00:00 Long Entry:  767600.0 Size:  2.3112386006030023
Date:  2018-05-06 21:00:00 Long close  Profit or Loss:  182461.73951488838
Date:  2018-05-13 21:00:00 Long Entry:  817400.0 Size:  2.3936487513307476
Date:  2018-05-16 09:00:00 Long close  Profit or Loss:  -149007.50714884064
Date:  2018-05-19 17:00:00 Long Entry:  786560.0 Size:  2.2980586124248785
Date:  2018-05-22 13:00:00 Long close  Profit or Loss:  -44910.04023917443
Date:  2018-05-30 09:00:00 Long Entry:  646720.0 Size:  2.7255240938114453
Date:  2018-06-04 21:00:00 Long close  Profit or Loss:  -13049.02308322751
Date:  2018-06-06 01:00:00 Long Entry:  673560.0 Size:  2.597544270542358
Date:  2018-06-09 21:00:00 Long close  Profit or Loss:  -49939.866636593266
Date:  2018-06-19 01:00:00 Long Entry:  564640.0 Size:  3.0101694039209357
Date:  2018-06-20 09:00:00 Long close  Profit or Loss:  -16449.97375854713
Date:  2018-06-20 21:00:00 Long Entry:  601880.0 Size:  2.7965908129051806
Date:  2018-06-22 09:00:00 Long close  Profit or Loss:  -80436.01207937092
Date:  2018-06-30 09:00:00 Long Entry:  499400.0 Size:  3.2094034168842596
Date:  2018-07-04 09:00:00 Long close  Profit or Loss:  18809.671545675268
Date:  2018-07-04 21:00:00 Long Entry:  530350.0 Size:  3.0575765776141686
Date:  2018-07-10 09:00:00 Long close  Profit or Loss:  -11109.092979445559
Date:  2018-07-14 01:00:00 Long Entry:  499600.0 Size:  3.2235321156089447
Date:  2018-07-19 05:00:00 Long close  Profit or Loss:  107929.60545378123
Date:  2018-07-24 13:00:00 Long Entry:  526420.0 Size:  3.2643255393260326
Date:  2018-07-27 13:00:00 Long close  Profit or Loss:  -38069.21730472806
Date:  2018-08-17 09:00:00 Long Entry:  344440.0 Size:  4.878460785934508
Date:  2018-08-18 21:00:00 Long close  Profit or Loss:  -57279.95947197144
Date:  2018-08-28 05:00:00 Long Entry:  317180.0 Size:  5.1171482238328725
Date:  2018-08-30 17:00:00 Long close  Profit or Loss:  -31003.777658558607
Date:  2018-09-01 21:00:00 Long Entry:  325740.0 Size:  4.887497071212476
Date:  2018-09-04 13:00:00 Long close  Profit or Loss:  -33676.80981948244
Date:  2018-09-13 21:00:00 Long Entry:  223170.0 Size:  6.982912067738806
Date:  2018-09-17 21:00:00 Long close  Profit or Loss:  84823.52776044361
Date:  2018-09-21 05:00:00 Long Entry:  242920.0 Size:  6.764366927044759
Date:  2018-09-24 17:00:00 Long close  Profit or Loss:  118125.30600389867
Date:  2018-09-28 05:00:00 Long Entry:  259680.0 Size:  6.782676062544715
Date:  2018-10-03 09:00:00 Long close  Profit or Loss:  -42504.996081148965
Date:  2018-10-06 05:00:00 Long Entry:  254920.0 Size:  6.742587179666023
Date:  2018-10-10 13:00:00 Long close  Profit or Loss:  -5006.370980902022
Date:  2018-10-15 13:00:00 Long Entry:  229020.0 Size:  7.483250165311154
Date:  2018-10-15 21:00:00 Long close  Profit or Loss:  37507.42786926367
Date:  2018-10-21 09:00:00 Long Entry:  232030.0 Size:  7.547823043265199
Date:  2018-10-22 21:00:00 Long close  Profit or Loss:  -30412.443388228465
Date:  2018-10-26 17:00:00 Long Entry:  229170.0 Size:  7.509311591135819
Date:  2018-10-26 17:00:00 Long close  Profit or Loss:  -22971.73508844358
Date:  2018-11-02 09:00:00 Long Entry:  224520.0 Size:  7.562520943578086
Date:  2018-11-04 09:00:00 Long close  Profit or Loss:  -7486.895734142306
Date:  2018-11-04 13:00:00 Long Entry:  226880.0 Size:  7.4508564285878425
Date:  2018-11-04 13:00:00 Long close  Profit or Loss:  -24784.5288240546
Date:  2018-11-04 21:00:00 Long Entry:  226940.0 Size:  7.339674705622433
Date:  2018-11-05 09:00:00 Long close  Profit or Loss:  47747.4826631479
Date:  2018-11-06 17:00:00 Long Entry:  239750.0 Size:  7.146666362281972
Date:  2018-11-09 01:00:00 Long close  Profit or Loss:  -8385.652696800158
Date:  2018-11-28 21:00:00 Long Entry:  133490.0 Size:  12.772699135967509
Date:  2018-12-01 05:00:00 Long close  Profit or Loss:  -84313.80989890776
Date:  2018-12-17 21:00:00 Long Entry:  97426.0 Size:  16.635331408057343
Date:  2018-12-22 05:00:00 Long close  Profit or Loss:  354171.0026764624
Date:  2018-12-23 09:00:00 Long Entry:  132170.0 Size:  14.942004996881723
Date:  2018-12-25 09:00:00 Long close  Profit or Loss:  203025.2582123391
Date:  2018-12-29 01:00:00 Long Entry:  148300.0 Size:  14.685839909981096
Date:  2019-01-01 01:00:00 Long close  Profit or Loss:  -31669.925010067618
Date:  2019-01-02 13:00:00 Long Entry:  160790.0 Size:  13.348094618074066
Date:  2019-01-08 05:00:00 Long close  Profit or Loss:  111134.90098062287
Date:  2019-01-14 21:00:00 Long Entry:  142370.0 Size:  15.855693156007248
Date:  2019-01-14 21:00:00 Long close  Profit or Loss:  -166232.67261689558
Date:  2019-01-15 01:00:00 Long Entry:  142370.0 Size:  14.68808289670476
Date:  2019-01-16 05:00:00 Long close  Profit or Loss:  -138020.35637886348
Date:  2019-02-03 05:00:00 Long Entry:  120330.0 Size:  16.231380417393776
Date:  2019-02-06 05:00:00 Long close  Profit or Loss:  -34066.42122002606
Date:  2019-02-08 17:00:00 Long Entry:  118340.0 Size:  16.21645753257535
Date:  2019-02-10 13:00:00 Long close  Profit or Loss:  137573.29900567533
Date:  2019-02-11 05:00:00 Long Entry:  130210.0 Size:  15.794707652335784
Date:  2019-02-17 21:00:00 Long close  Profit or Loss:  116457.70574061396
Date:  2019-02-18 01:00:00 Long Entry:  141930.0 Size:  15.310974347574552
Date:  2019-02-24 21:00:00 Long close  Profit or Loss:  303157.29208197613
Date:  2019-02-28 21:00:00 Long Entry:  153690.0 Size:  16.111938845944646
Date:  2019-03-02 13:00:00 Long close  Profit or Loss:  -103468.53684047493
Date:  2019-03-05 21:00:00 Long Entry:  148060.0 Size:  16.02576890715087
Date:  2019-03-09 05:00:00 Long close  Profit or Loss:  -46644.60298115332
Date:  2019-03-09 13:00:00 Long Entry:  152520.0 Size:  15.251316164513536
Date:  2019-03-11 17:00:00 Long close  Profit or Loss:  -72807.7131551374
Date:  2019-03-13 21:00:00 Long Entry:  149570.0 Size:  15.065340832095119
Date:  2019-03-14 21:00:00 Long close  Profit or Loss:  -63984.00904799118
Date:  2019-03-15 17:00:00 Long Entry:  149690.0 Size:  14.62582015637969
Date:  2019-03-17 09:00:00 Long close  Profit or Loss:  41509.02183991805
Date:  2019-03-18 09:00:00 Long Entry:  157340.0 Size:  14.178518120302492
Date:  2019-03-18 13:00:00 Long close  Profit or Loss:  -65766.4570038958
Date:  2019-03-21 21:00:00 Long Entry:  156050.0 Size:  13.87428121784363
Date:  2019-03-21 21:00:00 Long close  Profit or Loss:  -35025.62293444624
Date:  2019-03-23 09:00:00 Long Entry:  155430.0 Size:  13.704278203114278
Date:  2019-03-25 21:00:00 Long close  Profit or Loss:  -36088.84622008114
Date:  2019-03-27 09:00:00 Long Entry:  154640.0 Size:  13.540915124741147
Date:  2019-03-30 13:00:00 Long close  Profit or Loss:  55493.38588590769
Date:  2019-04-02 13:00:00 Long Entry:  163600.0 Size:  13.138511618434467
Date:  2019-04-05 01:00:00 Long close  Profit or Loss:  187343.96368967314
Date:  2019-04-05 21:00:00 Long Entry:  190360.0 Size:  12.275711622533894
Date:  2019-04-06 17:00:00 Long close  Profit or Loss:  -94403.11354246386
Date:  2019-04-07 01:00:00 Long Entry:  193060.0 Size:  11.615048953294771
Date:  2019-04-11 09:00:00 Long close  Profit or Loss:  41305.11612766067
Date:  2019-04-15 05:00:00 Long Entry:  191840.0 Size:  11.904224703141935
Date:  2019-04-16 01:00:00 Long close  Profit or Loss:  -45844.359754269906
Date:  2019-04-17 09:00:00 Long Entry:  193550.0 Size:  11.562191202771785
Date:  2019-04-21 17:00:00 Long close  Profit or Loss:  29408.374229582492
Date:  2019-04-23 13:00:00 Long Entry:  202340.0 Size:  11.205250971266489
Date:  2019-04-24 09:00:00 Long close  Profit or Loss:  -74990.02160010385
Date:  2019-04-30 21:00:00 Long Entry:  184230.0 Size:  11.899693100613133
Date:  2019-05-04 21:00:00 Long close  Profit or Loss:  27668.94304238554
Date:  2019-05-06 21:00:00 Long Entry:  193560.0 Size:  11.469050438976767
Date:  2019-05-08 05:00:00 Long close  Profit or Loss:  10708.901173728429
Date:  2019-05-10 13:00:00 Long Entry:  205460.0 Size:  10.856898199854333
Date:  2019-05-17 17:00:00 Long close  Profit or Loss:  693366.536366941
Date:  2019-05-21 05:00:00 Long Entry:  304330.0 Size:  9.608072948802327
Date:  2019-05-23 05:00:00 Long close  Profit or Loss:  -90744.40577225847
Date:  2019-05-25 17:00:00 Long Entry:  304950.0 Size:  9.290967157687339
Date:  2019-05-31 05:00:00 Long close  Profit or Loss:  123529.91203846356
Date:  2019-06-08 01:00:00 Long Entry:  305400.0 Size:  9.681762759578316
Date:  2019-06-09 21:00:00 Long close  Profit or Loss:  -116361.23390226795
Date:  2019-06-12 05:00:00 Long Entry:  298570.0 Size:  9.513511447476134
Date:  2019-06-18 21:00:00 Long close  Profit or Loss:  168871.4876507146
Date:  2019-06-21 05:00:00 Long Entry:  323770.0 Size:  9.294624580793972
Date:  2019-06-27 13:00:00 Long close  Profit or Loss:  642085.3217033647
Date:  2019-07-08 01:00:00 Long Entry:  353760.0 Size:  10.321703760252795
Date:  2019-07-10 21:00:00 Long close  Profit or Loss:  -21561.006984792064
Date:  2019-07-20 09:00:00 Long Entry:  264620.0 Size:  13.717197926242298
Date:  2019-07-22 21:00:00 Long close  Profit or Loss:  -53233.70171216111
Date:  2019-07-25 09:00:00 Long Entry:  264800.0 Size:  13.506839930249528
Date:  2019-07-27 17:00:00 Long close  Profit or Loss:  -259278.64998506295
Date:  2019-07-31 13:00:00 Long Entry:  251610.0 Size:  13.184422572811146
Date:  2019-08-08 01:00:00 Long close  Profit or Loss:  189930.23658621084
Date:  2019-08-18 17:00:00 Long Entry:  227650.0 Size:  15.40638172691071
Date:  2019-08-21 09:00:00 Long close  Profit or Loss:  39602.494461847804
Date:  2019-09-02 17:00:00 Long Entry:  208960.0 Size:  16.97389593507404
Date:  2019-09-05 05:00:00 Long close  Profit or Loss:  -5350.032758268905
Date:  2019-09-08 01:00:00 Long Entry:  211320.0 Size:  16.75901600338256
Date:  2019-09-11 13:00:00 Long close  Profit or Loss:  11613.998090344114
Date:  2019-09-14 21:00:00 Long Entry:  215760.0 Size:  16.467970244369422
Date:  2019-09-19 09:00:00 Long close  Profit or Loss:  408801.59948105284
Date:  2019-09-19 21:00:00 Long Entry:  250400.0 Size:  15.822407585488014
Date:  2019-09-22 09:00:00 Long close  Profit or Loss:  -3652.958036624023
Date:  2019-09-28 21:00:00 Long Entry:  206360.0 Size:  19.18142034003477
Date:  2019-10-03 21:00:00 Long close  Profit or Loss:  42786.69056019768
Date:  2019-10-07 21:00:00 Long Entry:  212120.0 Size:  18.86226943206568
Date:  2019-10-11 17:00:00 Long close  Profit or Loss:  118421.42543234353
Date:  2019-10-15 01:00:00 Long Entry:  219560.0 Size:  18.762461365285645
Date:  2019-10-16 01:00:00 Long close  Profit or Loss:  -106805.31132188854
Date:  2019-10-21 17:00:00 Long Entry:  208610.0 Size:  19.235322880208173
Date:  2019-10-21 21:00:00 Long close  Profit or Loss:  -101499.02824199447
Date:  2019-10-25 21:00:00 Long Entry:  201180.0 Size:  19.44120527785184
Date:  2019-10-26 17:00:00 Long close  Profit or Loss:  107856.95853844305
Date:  2019-10-29 21:00:00 Long Entry:  216590.0 Size:  18.555975051187385
Date:  2019-10-31 09:00:00 Long close  Profit or Loss:  -67603.12830648589
Date:  2019-11-03 09:00:00 Long Entry:  214700.0 Size:  18.404450433303168
Date:  2019-11-04 01:00:00 Long close  Profit or Loss:  -84724.88756971114
Date:  2019-11-04 17:00:00 Long Entry:  214760.0 Size:  18.00479894049394
Date:  2019-11-07 17:00:00 Long close  Profit or Loss:  -30302.076616851304
Date:  2019-11-10 13:00:00 Long Entry:  219140.0 Size:  17.506655762725327
Date:  2019-11-12 21:00:00 Long close  Profit or Loss:  -74525.83358192172
Date:  2019-11-17 21:00:00 Long Entry:  216040.0 Size:  17.412899047684252
Date:  2019-11-19 01:00:00 Long close  Profit or Loss:  -103087.8449421003
Date:  2019-11-27 21:00:00 Long Entry:  174220.0 Size:  21.001003704050085
Date:  2019-12-01 09:00:00 Long close  Profit or Loss:  26196.652020432077
Date:  2019-12-04 21:00:00 Long Entry:  176240.0 Size:  20.908939612687462
Date:  2019-12-05 05:00:00 Long close  Profit or Loss:  -96875.29901350355
Date:  2019-12-08 17:00:00 Long Entry:  174280.0 Size:  20.588227096204584
Date:  2019-12-09 21:00:00 Long close  Profit or Loss:  -26089.401376310445
Date:  2019-12-22 21:00:00 Long Entry:  149430.0 Size:  23.837427671486477
Date:  2019-12-24 05:00:00 Long close  Profit or Loss:  -32802.68421873254
Date:  2019-12-29 21:00:00 Long Entry:  148990.0 Size:  23.687657780599313
Date:  2020-01-01 05:00:00 Long close  Profit or Loss:  -30988.844006630585
Date:  2020-01-03 17:00:00 Long Entry:  150260.0 Size:  23.28121448638933
Date:  2020-01-08 21:00:00 Long close  Profit or Loss:  236299.05566593207
Date:  2020-01-12 01:00:00 Long Entry:  163790.0 Size:  22.80074695885459
Date:  2020-01-19 21:00:00 Long close  Profit or Loss:  522792.47083769867
Date:  2020-01-26 17:00:00 Long Entry:  190220.0 Size:  22.381068316835727
Date:  2020-01-30 09:00:00 Long close  Profit or Loss:  115966.58927402877
Date:  2020-01-30 21:00:00 Long Entry:  202170.0 Size:  21.63176240046753
Date:  2020-02-16 09:00:00 Long close  Profit or Loss:  2047530.6750776134
Date:  2020-02-18 21:00:00 Long Entry:  319400.0 Size:  20.102767938572743
Date:  2020-02-20 17:00:00 Long close  Profit or Loss:  -325664.36898090976
Date:  2020-02-23 13:00:00 Long Entry:  319990.0 Size:  19.047969344664597
Date:  2020-02-25 13:00:00 Long close  Profit or Loss:  -177071.82782493657
Date:  2020-03-03 01:00:00 Long Entry:  277060.0 Size:  21.360311422703703
Date:  2020-03-08 09:00:00 Long close  Profit or Loss:  113836.90045685046
Date:  2020-03-19 17:00:00 Long Entry:  155600.0 Size:  38.765583439788806
Date:  2020-03-21 05:00:00 Long close  Profit or Loss:  127111.53981164018
Date:  2020-03-24 17:00:00 Long Entry:  169940.0 Size:  36.24241687091196
Date:  2020-03-27 21:00:00 Long close  Profit or Loss:  -134549.97263326065
Date:  2020-03-31 17:00:00 Long Entry:  162220.0 Size:  37.13775336215952
Date:  2020-04-10 13:00:00 Long close  Profit or Loss:  1275793.241250266
Date:  2020-04-16 13:00:00 Long Entry:  197260.0 Size:  37.008413219404765
Date:  2020-04-21 01:00:00 Long close  Profit or Loss:  432332.2832290865
Date:  2020-04-22 21:00:00 Long Entry:  221920.0 Size:  34.8441414693983
Date:  2020-04-30 17:00:00 Long close  Profit or Loss:  994920.4433656906
Date:  2020-05-07 21:00:00 Long Entry:  253000.0 Size:  34.49617517096665
Date:  2020-05-10 09:00:00 Long stop loss  Profit or Loss:  -881480.7641437108
Date:  2020-05-13 21:00:00 Long Entry:  233330.0 Size:  33.62641560926949
Date:  2020-05-21 17:00:00 Long close  Profit or Loss:  569594.4913638551
Date:  2020-05-23 09:00:00 Long Entry:  253640.0 Size:  33.17949079591037
Date:  2020-05-26 21:00:00 Long close  Profit or Loss:  -291687.53948500723
Date:  2020-05-27 17:00:00 Long Entry:  251840.0 Size:  32.25841211082314
Date:  2020-06-02 21:00:00 Long close  Profit or Loss:  758156.5564758318
Date:  2020-06-04 09:00:00 Long Entry:  296360.0 Size:  29.97069463647432
Date:  2020-06-07 17:00:00 Long close  Profit or Loss:  -222532.40767582183
Date:  2020-06-08 05:00:00 Long Entry:  293960.0 Size:  29.458370712987172
Date:  2020-06-11 21:00:00 Long close  Profit or Loss:  -125404.28412518639
Date:  2020-06-16 17:00:00 Long Entry:  282280.0 Size:  30.2330252609626
Date:  2020-06-19 09:00:00 Long close  Profit or Loss:  -212208.62760922257
Date:  2020-06-22 09:00:00 Long Entry:  279070.0 Size:  29.820366728975884
Date:  2020-06-24 17:00:00 Long close  Profit or Loss:  201235.19982742492
Date:  2020-07-01 17:00:00 Long Entry:  272170.0 Size:  31.315739952539676
Date:  2020-07-04 05:00:00 Long close  Profit or Loss:  -80916.74046336726
Date:  2020-07-06 13:00:00 Long Entry:  273580.0 Size:  30.858572272897717
Date:  2020-07-10 13:00:00 Long close  Profit or Loss:  249287.8902493769
Date:  2020-07-13 09:00:00 Long Entry:  287030.0 Size:  30.281071987836583
Date:  2020-07-16 01:00:00 Long close  Profit or Loss:  -118114.34939575537
Date:  2020-07-20 01:00:00 Long Entry:  280280.0 Size:  30.588917308666257
Date:  2020-08-02 13:00:00 Long close  Profit or Loss:  3457413.322239122
Date:  2020-08-03 21:00:00 Long Entry:  469370.0 Size:  25.63196426169568
Date:  2020-08-07 21:00:00 Long close  Profit or Loss:  -300955.1451822736
Date:  2020-08-09 09:00:00 Long Entry:  470770.0 Size:  24.91645584962896
Date:  2020-08-11 21:00:00 Long close  Profit or Loss:  -431924.27050773305
Date:  2020-08-13 09:00:00 Long Entry:  464250.0 Size:  24.336016477807416
Date:  2020-08-16 17:00:00 Long close  Profit or Loss:  664345.6103703239
Date:  2020-08-17 01:00:00 Long Entry:  506760.0 Size:  23.60553567801803
Date:  2020-08-18 21:00:00 Long close  Profit or Loss:  -356618.2697020896
Date:  2020-08-25 05:00:00 Long Entry:  476520.0 Size:  24.3551645061914
Date:  2020-08-25 21:00:00 Long close  Profit or Loss:  -381927.94772029103
Date:  2020-08-29 01:00:00 Long Entry:  464930.0 Size:  24.140827743466836
Date:  2020-09-02 17:00:00 Long close  Profit or Loss:  1232465.7783809144
Date:  2020-09-10 01:00:00 Long Entry:  425200.0 Size:  29.295063078906278
Date:  2020-09-13 21:00:00 Long close  Profit or Loss:  205914.9983816322
Date:  2020-09-17 09:00:00 Long Entry:  448620.0 Size:  28.224724309064644
Date:  2020-09-20 21:00:00 Long close  Profit or Loss:  -198395.29077030532
Date:  2020-09-25 05:00:00 Long Entry:  403690.0 Size:  30.87463283401193
Date:  2020-10-02 01:00:00 Long close  Profit or Loss:  275704.2962811597
Date:  2020-10-05 21:00:00 Long Entry:  410820.0 Size:  31.009894418585837
Date:  2020-10-06 17:00:00 Long close  Profit or Loss:  -150428.9978245599
Date:  2020-10-09 17:00:00 Long Entry:  408320.0 Size:  30.831347539231178
Date:  2020-10-15 17:00:00 Long close  Profit or Loss:  649745.6237807802
Date:  2020-10-19 05:00:00 Long Entry:  433410.0 Size:  30.545676036546585
Date:  2020-10-20 17:00:00 Long close  Profit or Loss:  -305728.6168821911
Date:  2020-10-21 21:00:00 Long Entry:  434800.0 Size:  29.74487772336123
Date:  2020-10-26 05:00:00 Long close  Profit or Loss:  716161.4719698237
Date:  2020-11-01 09:00:00 Long Entry:  441560.0 Size:  30.91139212357842
Date:  2020-11-02 17:00:00 Long close  Profit or Loss:  -168879.78428567568
Date:  2020-11-05 01:00:00 Long Entry:  450510.0 Size:  29.922431292982644
Date:  2020-11-14 17:00:00 Long close  Profit or Loss:  1634904.7932291152
Date:  2020-11-17 21:00:00 Long Entry:  513820.0 Size:  29.417421110565428
Date:  2020-11-18 13:00:00 Long close  Profit or Loss:  -304918.91491381667
Date:  2020-11-20 09:00:00 Long Entry:  535960.0 Size:  27.63329427591035
Date:  2020-11-26 05:00:00 Long close  Profit or Loss:  2445226.6957009574
Date:  2020-11-30 17:00:00 Long Entry:  631500.0 Size:  27.324730159648247
Date:  2020-12-01 21:00:00 Long close  Profit or Loss:  89485.19771390162
Date:  2020-12-13 05:00:00 Long Entry:  622760.0 Size:  27.851904896800963
Date:  2020-12-21 05:00:00 Long close  Profit or Loss:  1900909.2203496038
Date:  2020-12-23 09:00:00 Long Entry:  716800.0 Size:  26.849834701285396
Date:  2020-12-23 17:00:00 Long close  Profit or Loss:  -1287599.9330009618
Date:  2020-12-25 17:00:00 Long Entry:  701620.0 Size:  25.595566803797507
Date:  2021-01-02 01:00:00 Long close  Profit or Loss:  2568422.9847205863
Date:  2021-01-02 21:00:00 Long Entry:  825720.0 Size:  24.85925563823208
Date:  2021-01-04 17:00:00 Long close  Profit or Loss:  6855771.289898029
Date:  2021-01-05 09:00:00 Long Entry:  1226200.0 Size:  22.331231328901502
Date:  2021-01-11 09:00:00 Long close  Profit or Loss:  1494495.3254554041
Date:  2021-01-15 05:00:00 Long Entry:  1302300.0 Size:  22.17388557241375
Date:  2021-01-21 17:00:00 Long close  Profit or Loss:  1556407.2022132934
Date:  2021-01-24 13:00:00 Long Entry:  1458000.0 Size:  20.873428246342744
Date:  2021-01-26 21:00:00 Long close  Profit or Loss:  -625104.0602928033
Date:  2021-01-29 17:00:00 Long Entry:  1502300.0 Size:  19.84181210335813
Date:  2021-02-01 01:00:00 Long close  Profit or Loss:  -1345572.4877892316
Date:  2021-02-01 21:00:00 Long Entry:  1509000.0 Size:  18.862015795285412
Date:  2021-02-01 21:00:00 Long close  Profit or Loss:  -1344484.4858879442
Date:  2021-02-02 09:00:00 Long Entry:  1509000.0 Size:  17.971038667460398
Date:  2021-02-07 21:00:00 Long close  Profit or Loss:  2971151.822891228
Date:  2021-02-08 21:00:00 Long Entry:  1813100.0 Size:  16.595581695487823
Date:  2021-02-15 09:00:00 Long close  Profit or Loss:  1575601.1217513094
Date:  2021-02-16 01:00:00 Long Entry:  1973600.0 Size:  16.044310039440756
Date:  2021-02-21 05:00:00 Long close  Profit or Loss:  3056188.0879074004
Date:  2021-03-01 17:00:00 Long Entry:  1723600.0 Size:  20.144603377667487
Date:  2021-03-05 09:00:00 Long close  Profit or Loss:  153562.31154795925
Date:  2021-03-07 01:00:00 Long Entry:  1839500.0 Size:  18.95884788980464
Date:  2021-03-12 21:00:00 Long close  Profit or Loss:  3613082.4365995196
Date:  2021-03-13 17:00:00 Long Entry:  2119000.0 Size:  18.163229414768832
Date:  2021-03-15 13:00:00 Long close  Profit or Loss:  -1060914.2301166474
Date:  2021-03-09 05:00:00 Long Entry:  2098400.0 Size:  17.835955442136154
Date:  2021-03-12 21:00:00 Long close  Profit or Loss:  -1172464.366944262
Date:  2021-03-13 17:00:00 Long Entry:  2119000.0 Size:  17.109251785197852
Date:  2021-03-15 13:00:00 Long close  Profit or Loss:  -999351.3967734065
Date:  2021-03-18 09:00:00 Long Entry:  2145400.0 Size:  16.432904416920312
Date:  2021-03-21 21:00:00 Long close  Profit or Loss:  -1480440.358920351
Date:  2021-03-28 05:00:00 Long Entry:  2048000.0 Size:  16.49155897321313
Date:  2021-04-07 13:00:00 Long close  Profit or Loss:  8803326.112372955


(42578038.88951345,
 '4257.8038889513455%',
 180,
 0.43333333333333335,
 4.146248323553199)

output_10_2

Chandelier Exit 없이는 11000% 수익이었는데 4257%로 감소했습니다. 승률도 43%로 별 차이 없고 손익비는 4.14로 떨어졌습니다. Chandelier Exit의 추가가 오히려 안 좋은 결과를 가져왔습니다. 채널 하단 20%를 깰 정도의 하락 없이 애매하게 흘러내리다가 추세가 반전되어 재상승하는 경우가 많아 청산 전략이 오히려 수익을 깎아먹은 것으로 보입니다. 다른 암호화폐에 대한 결과는 아래와 같습니다.

 전략 누적 수익승률손익비매수 후 보유 누적 수익
Ethereum4257%43%4.14815%
Bitcoin1141%39%3.201692%
Bitcoin Cash1331%34%2.4076%
EOS149%33%2.104.3%
Ripple*783%30%2.80570%

(Ripple은 2021년 4월 1일 오전 5시 진입한 거래가 아직 청산되지 않아 수익에 반영되지 않았습니다)

Chandelier Exit 없이 하는 쪽이 훨씬 좋습니다. Chandelier Exit을 사용하면 매수 후 보유보다도 못한 결과가 나오기도 합니다. Chandelier Exit은 사용하지 않겠습니다.

본 글은 매수 및 매도, 종목 추천 등과는 무관하며, 거래에 따른 책임은 모두 거래 실행 당사자에게 있습니다.






© 2021.03. by JacobJinwonLee

Powered by theorydb