[암호화폐 트레이딩] CCI / ADX
[CCI]
단순 CCI를 이용한 전략을 구성해 보도록 하겠습니다.
if cci(a1)>a2 then buy 1 contracts next bar at market;
if cci(a1)<-a2 then sell 1 contracts next bar at market;
과매수 구간 추격 매수, 과매도 구간 추격 매도인 추세형 전략입니다. 지표에 대해서 설명하지 않는 이유는 지표에 대한 이해보다 해당 지표가 시장에서 통하느냐 통하지 않느냐가 더 중요하기 때문입니다. 또한 러프하게 최적화하는 이유는 세밀한 조정은 트레이더가 원하는 값으로 정하시길 원하기 때문이고 미세하게 조정한다고 해서 시장이 미세 조정에 따라 기가 막히게 움직여 주지 않을 것이기 때문입니다.
![]()
Net Profit으로 정렬했을 때 위와 같은 결과가 나왔습니다. 지표 하나로 지표와 시장의 궁합을 맞춰 볼 때는 하위 결과도 확인하는데 슬리피지를 감안하지 않고 반대로 거래했을 때 수익이 날 수 있는지를 보기 위함입니다. 역추세로 거래했을 때는 별로 좋은 결과를 보이지 않았기 때문에 생략하도록 하겠습니다.
위 결과에서 6개의 샘플을 검토해 보도록 하겠습니다.
최상위 결과는 위와 같습니다. 워치봇에서는 어떤 결과를 보이는지 확인해 보겠습니다. 대칭형 구조이니 매도 변수는 마이너스를 추가하시면 됩니다.
[BTC] 15 min
(100, 100) (100, -100)"lastBalance": 11538985, "earningsRate": 10.539, "totalFee": 6263035, "tradeCount": 307, "from": "2017-01-01 10:00", "to": "2018-03-29 10:00", "lastBalance": 1310984, "earningsRate": 0.311, "totalFee": 384095, "tradeCount": 58, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
(95, 130) (95, -130)"lastBalance": 9138980, "earningsRate": 8.139, "totalFee": 5045647, "tradeCount": 260, "from": "2017-01-01 03:00", "to": "2018-04-10 00:00", "lastBalance": 1264658, "earningsRate": 0.2647, "totalFee": 332677, "tradeCount": 52, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
(105, 90) (105, -90)"lastBalance": 7585422, "earningsRate": 6.5854, "totalFee": 5118461, "tradeCount": 328, "from": "2017-01-01 02:45", "to": "2018-04-10 00:00", "lastBalance": 1344279, "earningsRate": 0.3443, "totalFee": 404399, "tradeCount": 60, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
(95, 140) (95, -140)"lastBalance": 8229180, "earningsRate": 7.2292, "totalFee": 4335261, "tradeCount": 244, "from": "2017-01-01 03:00", "to": "2018-04-10 00:00", "lastBalance": 1261221, "earningsRate": 0.2612, "totalFee": 316946, "tradeCount": 48, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
(115, 70) (115, -70)"lastBalance": 5506704, "earningsRate": 4.5067, "totalFee": 4060629, "tradeCount": 364, "from": "2017-01-01 02:30", "to": "2018-04-10 00:00", "lastBalance": 1373001, "earningsRate": 0.373, "totalFee": 395884, "tradeCount": 60, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
(50, 150) (50, -150)"lastBalance": 2552492, "earningsRate": 1.5525, "totalFee": 3632825, "tradeCount": 432, "from": "2017-01-01 02:45", "to": "2018-04-10 00:00", "lastBalance": 839908, "earningsRate": -0.1601, "totalFee": 464653, "tradeCount": 88, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
(110, 60) (110, -60)"lastBalance": 5240967, "earningsRate": 4.241, "totalFee": 4884510, "tradeCount": 414, "from": "2017-01-01 02:15", "to": "2018-04-10 00:00", "lastBalance": 1276363, "earningsRate": 0.2764, "totalFee": 480621, "tradeCount": 74, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
[ETH] (100, 100) (100, -100) "lastBalance": 11538985, "earningsRate": 10.539, "totalFee": 6263035, "tradeCount": 307, "from": "2017-01-01 10:00", "to": "2018-03-29 10:00", "lastBalance": 1310984, "earningsRate": 0.311, "totalFee": 384095, "tradeCount": 58, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
(95, 130)(95, -130) "lastBalance": 9138980, "earningsRate": 8.139, "totalFee": 5045647, "tradeCount": 260, "from": "2017-01-01 03:00", "to": "2018-04-10 00:00", "lastBalance": 1264658, "earningsRate": 0.2647, "totalFee": 332677, "tradeCount": 52, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
(105, 90)(105, -90) "lastBalance": 30769475, "earningsRate": 29.7695, "totalFee": 42348736, "tradeCount": 346, "from": "2017-01-01 09:45", "to": "2018-04-10 00:00", "lastBalance": 789604, "earningsRate": -0.2104, "totalFee": 444763, "tradeCount": 76, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
(95, 140)(95, -140) "lastBalance": 43496114, "earningsRate": 42.4961, "totalFee": 36092699, "tradeCount": 251, "from": "2017-01-01 09:45", "to": "2018-04-10 00:00", "lastBalance": 901248, "earningsRate": -0.0988, "totalFee": 324840, "tradeCount": 53, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
(115, 70)(115, -70) "lastBalance": 21366004, "earningsRate": 20.366, "totalFee": 34398478, "tradeCount": 398, "from": "2017-01-01 09:30", "to": "2018-04-10 00:00", "lastBalance": 810876, "earningsRate": -0.1891, "totalFee": 460010, "tradeCount": 78, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
(50, 150)(50, -150) "lastBalance": 24734331, "earningsRate": 23.7343, "totalFee": 38508447, "tradeCount": 402, "from": "2017-01-01 09:45", "to": "2018-04-10 00:00", "lastBalance": 867479, "earningsRate": -0.1325, "totalFee": 614315, "tradeCount": 90, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
(110, 60)(110, -60) "lastBalance": 18359392, "earningsRate": 17.3594, "totalFee": 30328643, "tradeCount": 456, "from": "2017-01-01 09:30", "to": "2018-04-10 00:00", "lastBalance": 1016125, "earningsRate": 0.0161, "totalFee": 556620, "tradeCount": 80, "from": "2018-01-01 01:15", "to": "2018-04-10 00:00",
[ADX]
단순 ADX를 이용한 전략을 구성해 보도록 하겠습니다.
if adx(a1)>a2 then buy 1 contracts next bar at market;
if adx(a1)<a2-a3 then sell 1 contracts next bar at market;
추세 구간 매수, 비추세 구간 매도인 추세형 전략입니다.
과거에는 주로 상승장이었고 추세장이었기 때문에 수익이 났지만 하락장 추세에서는 진입하면 손실이 발생하는 모습입니다. 따라서 위 결과에 단기적 상승을 확인할 수 있는 가격 필터를 넣어 보겠습니다.
if adx(a1)>a2 and c>average(c,a4) then buy 1 contracts next bar at market;
if adx(a1)<a2-a3 and c<average(c,a4) then sell 1 contracts next bar at market;
ADX 에 Price Comparison을 추가했습니다.
거래 횟수 40 이상 인 결과만 추려서 보면 위와 같습니다.
ADX Period는 10~20, SMA는 70~300 사이에서 의미 있는 결과를 보입니다. 위 결과 중 6개를 샘플링해보겠습니다.
[BTC] 15 min
매수 ADX(20, 30) up & PC(C[0], SMA(170) up / 매도 ADX(20,10) down & PC(C[0], SMA(170) down "lastBalance": 13788078, "earningsRate": 12.7881, "totalFee": 2293529, "tradeCount": 99, "from": "2017-01-01 21:45", "to": "2018-04-10 10:00", "lastBalance": 1761440, "earningsRate": 0.7614, "totalFee": 166742, "tradeCount": 19, "from": "2018-01-03 05:00", "to": "2018-04-10 10:00",
매수 ADX(20, 20) up & PC(C[0], SMA(150) up / 매도 ADX(20,10) down & PC(C[0], SMA(150) down "lastBalance": 9748869, "earningsRate": 8.7489, "totalFee": 3252313, "tradeCount": 143, "from": "2017-01-01 10:00", "to": "2018-04-10 10:00", "lastBalance": 937563, "earningsRate": -0.0624, "totalFee": 176969, "tradeCount": 33, "from": "2018-01-01 16:45", "to": "2018-04-10 10:00",
매수 ADX(20, 30) up & PC(C[0], SMA(270) up / 매도 ADX(20,10) down & PC(C[0], SMA(270) down "lastBalance": 9067336, "earningsRate": 8.0673, "totalFee": 1780656, "tradeCount": 89, "from": "2017-01-01 21:45", "to": "2018-04-10 10:00", "lastBalance": 1073770, "earningsRate": 0.0738, "totalFee": 86511, "tradeCount": 15, "from": "2018-01-03 05:00", "to": "2018-04-10 10:00",
매수 ADX(10, 50) up & PC(C[0], SMA(180) up / 매도 ADX(10,20) down & PC(C[0], SMA(180) down "lastBalance": 4883731, "earningsRate": 3.8837, "totalFee": 1619961, "tradeCount": 169, "from": "2017-01-01 21:00", "to": "2018-04-10 10:00", "lastBalance": 1229373, "earningsRate": 0.2294, "totalFee": 181778, "tradeCount": 29, "from": "2018-01-03 05:00", "to": "2018-04-10 10:00",
매수 ADX(10, 50) up & PC(C[0], SMA(230) up / 매도 ADX(10,20) down & PC(C[0], SMA(230) down "lastBalance": 6250420, "earningsRate": 5.2504, "totalFee": 1734526, "tradeCount": 147, "from": "2017-01-01 21:00", "to": "2018-04-10 10:00", "lastBalance": 1223970, "earningsRate": 0.224, "totalFee": 144151, "tradeCount": 23, "from": "2018-01-03 05:00", "to": "2018-04-10 10:00",
매수 ADX(10, 40) up & PC(C[0], SMA(140) up / 매도 ADX(10,20) down & PC(C[0], SMA(140) down "lastBalance": 3522846, "earningsRate": 2.5228, "totalFee": 2667059, "tradeCount": 283, "from": "2017-01-01 10:30", "to": "2018-04-10 10:00", "lastBalance": 960191, "earningsRate": -0.0398, "totalFee": 278299, "tradeCount": 55, "from": "2018-01-03 04:30", "to": "2018-04-10 10:00",
[ETH]
매수 ADX(20, 30) up & PC(C[0], SMA(170) up / 매도 ADX(20,10) down & PC(C[0], SMA(170) down "lastBalance": 47083309, "earningsRate": 46.0833, "totalFee": 13250366, "tradeCount": 111, "from": "2017-01-01 10:00", "to": "2018-04-10 10:00", "lastBalance": 987851, "earningsRate": -0.0121, "totalFee": 112198, "tradeCount": 19, "from": "2018-01-01 15:00", "to": "2018-04-10 10:00",
매수 ADX(20, 20) up & PC(C[0], SMA(150) up / 매도 ADX(20,10) down & PC(C[0], SMA(150) down "lastBalance": 21875517, "earningsRate": 20.8755, "totalFee": 20033032, "tradeCount": 163, "from": "2017-01-01 10:00", "to": "2018-04-10 10:00", "lastBalance": 401084, "earningsRate": -0.5989, "totalFee": 157465, "tradeCount": 37, "from": "2018-01-01 13:45", "to": "2018-04-10 10:00",
매수 ADX(20, 30) up & PC(C[0], SMA(270) up / 매도 ADX(20,10) down & PC(C[0], SMA(270) down "lastBalance": 42541024, "earningsRate": 41.541, "totalFee": 14653679, "tradeCount": 101, "from": "2017-01-01 10:00", "to": "2018-04-10 10:00", "lastBalance": 748083, "earningsRate": -0.2519, "totalFee": 103158, "tradeCount": 21, "from": "2018-01-01 15:00", "to": "2018-04-10 10:00",
매수 ADX(10, 50) up & PC(C[0], SMA(180) up / 매도 ADX(10,20) down & PC(C[0], SMA(180) down "lastBalance": 42490711, "earningsRate": 41.4907, "totalFee": 21367091, "tradeCount": 170, "from": "2017-01-01 10:00", "to": "2018-04-10 10:00", "lastBalance": 926529, "earningsRate": -0.0735, "totalFee": 231829, "tradeCount": 34, "from": "2018-01-01 14:30", "to": "2018-04-10 10:00",
매수 ADX(10, 50) up & PC(C[0], SMA(230) up / 매도 ADX(10,20) down & PC(C[0], SMA(230) down "lastBalance": 50905385, "earningsRate": 49.9054, "totalFee": 21029527, "tradeCount": 144, "from": "2017-01-01 10:00", "to": "2018-04-10 10:00", "lastBalance": 985151, "earningsRate": -0.0148, "totalFee": 191973, "tradeCount": 28, "from": "2018-01-01 14:30", "to": "2018-04-10 10:00",
매수 ADX(10, 40) up & PC(C[0], SMA(140) up / 매도 ADX(10,20) down & PC(C[0], SMA(140) down "lastBalance": 51619380, "earningsRate": 50.6194, "totalFee": 54434759, "tradeCount": 298, "from": "2017-01-01 10:00", "to": "2018-04-10 10:00", "lastBalance": 736732, "earningsRate": -0.2633, "totalFee": 374701, "tradeCount": 62, "from": "2018-01-01 13:45", "to": "2018-04-10 10:00",
위 결과에 적절한 익절이나 손절이 의미가 있을지 확인해 보도록 하겠습니다. 확인하고자 하는 이유는 거래 빈도가 적어서 적절히 쉬어 갈 수 있는지를 알아보고자 함입니다. 경우의 수를 줄이기 위해 Price Comparison 의 SMA Long Period를 170으로 고정하고 다음 조건에 익절을 추가해 보겠습니다.
if adx(a1)>a2 and c>average(c,170) then buy 1 contracts next bar at market;
if adx(a1)<a2-a3 and c<average(c,170) then sell 1 contracts next bar at market;
setprofittarget(c*0.01*a4);
[BTC] 15 min
[매수 ADX(20, 30) up & PC(C[0], SMA(170) up / 매도 ADX(20,10) down & PC(C[0], SMA(170) down)]
익절 15% "lastBalance": 9165105, "earningsRate": 8.1651, "totalFee": 2785115, "tradeCount": 161, "from": "2017-01-01 21:45", "to": "2018-04-10 10:00", "lastBalance": 1598659, "earningsRate": 0.5987, "totalFee": 192436, "tradeCount": 25, "from": "2018-01-03 05:00", "to": "2018-04-10 10:00",
익절 5% "lastBalance": 2622671, "earningsRate": 1.6227, "totalFee": 2378336, "tradeCount": 303, "from": "2017-01-01 21:45", "to": "2018-04-10 10:00", "lastBalance": 1234764, "earningsRate": 0.2348, "totalFee": 254549, "tradeCount": 41, "from": "2018-01-03 05:00", "to": "2018-04-10 10:00",
거래 횟수는 많이 증가하지만 수익이 많이 하락합니다.
if adx(a1)>a2 and c>average(c,170) then buy 1 contracts next bar at market;
if adx(a1)<a2-a3 and c<average(c,170) then sell 1 contracts next bar at market;
setstoploss(c*0.01*a4);
익절은 제외하고 손절을 추가해 보도록 하겠습니다.
손절 17% "lastBalance": 17549221, "earningsRate": 16.5492, "totalFee": 3097776, "tradeCount": 105, "from": "2017-01-01 21:45", "to": "2018-04-10 10:00", "lastBalance": 1761440, "earningsRate": 0.7614, "totalFee": 166742, "tradeCount": 19, "from": "2018-01-03 05:00", "to": "2018-04-10 10:00",
손절 9% "lastBalance": 18790418, "earningsRate": 17.7904, "totalFee": 3360749, "tradeCount": 111, "from": "2017-01-01 21:45", "to": "2018-04-10 10:00", "lastBalance": 1737878, "earningsRate": 0.7379, "totalFee": 166503, "tradeCount": 19, "from": "2018-01-03 05:00", "to": "2018-04-10 10:00",
손절에 많이 걸리지는 않아 전체 전략에 큰 영향은 없으나 안전장치로는 손절 9~17% 가 적절해 보입니다. 다른 코인들도 확인해 보도록 하겠습니다.
[매수 ADX(20, 30) up & PC(C[0], SMA(170) up / 매도 ADX(20,10) down & PC(C[0], SMA(170) down)] 손절 9%
[ETH] "lastBalance": 31688409, "earningsRate": 30.6884, "totalFee": 11455724, "tradeCount": 139, "from": "2017-01-01 10:00", "to": "2018-04-10 10:00", "lastBalance": 1187285, "earningsRate": 0.1873, "totalFee": 177743, "tradeCount": 25, "from": "2018-01-01 15:00", "to": "2018-04-10 10:00",
[ETC] "lastBalance": 2373121, "earningsRate": 1.3731, "totalFee": 2111385, "tradeCount": 165, "from": "2017-01-01 12:00", "to": "2018-04-10 10:00", "lastBalance": 768416, "earningsRate": -0.2316, "totalFee": 140959, "tradeCount": 31, "from": "2018-01-01 13:30", "to": "2018-04-10 10:00",
[LTC] "lastBalance": 901422, "earningsRate": -0.0986, "totalFee": 149271, "tradeCount": 31, "from": "2017-12-19 07:30", "to": "2018-04-10 10:00", "lastBalance": 982448, "earningsRate": -0.0176, "totalFee": 133549, "tradeCount": 25, "from": "2018-01-02 12:15", "to": "2018-04-10 10:00",
[BCH] "lastBalance": 1599083, "earningsRate": 0.5991, "totalFee": 1235889, "tradeCount": 135, "from": "2017-08-11 20:30", "to": "2018-04-10 10:00", "lastBalance": 669707, "earningsRate": -0.3303, "totalFee": 142543, "tradeCount": 33, "from": "2018-01-01 15:15", "to": "2018-04-10 10:00",
Test Spec Tool : Multichart 8.0
Exchange : Coinone
Timeframe : 15 min
Slippage&Commission : 20000
Initial Capital : 1000000
Period : 2017.01.01~2018.03.16
Value : BTC/KRW