
이제 시장에서 통하는 전략인지 확인해보자
&빼주자 금지어제한때매..

저번에 작성했던 지표 그대로 가져와준다
//@version=4
study("전갤")
plot(rsi(close,14))
signal1= rsi(close,14) < 30
plotshape(signal1, style=shape.labelup, location=location&.belowbar,size=size.small,color=#FF5252)
alertcondition(signal1, title='BUY')
signal2= rsi(close,14) > 70
plotshape(signal2, style=shape.labelup, location=location&.belowbar,size=size.small,color=#FFFFFF)
alertcondition(signal2, title='SELL')
study=지표 를 strategy=전략으로 바꿔주고 제목도 전갤전략으로 바꿔주었다
그리고 전부 지워준다
매수조건문
매도조건문
스탑조건문을 넣어준다

매수 조건에 rsi 30이하일때 매도 조건에 rsi 70이상일때 스탑조건에 -10% 손실제한을 넣어주자
원본
//@version=4
strategy("전갤전략")
buycondition = rsi(close,14) < 30
sellcondition = rsi(close,14) > 70
stopLoss = strategy&.position_avg_price *0.90
설명
//@version=4
strategy("전갤전략")
buycondition = rsi(close,14) < 30
rsi 30이하일때 buy한다는 조건이다
sellcondition = rsi(close,14) > 70
rsi 70이상일때 sell한다는 조건이다
stopLoss = strategy&.position_avg_price *0.90
보유한 포지션의 가치가 10%떨어졌을때 손절한다는 조건이다
원본
//@version=4
strategy("전갤전략")
buycondition = rsi(close,14) < 30
sellcondition = rsi(close,14) > 70
stopLoss = strategy&.position_avg_price *0.90
strategy&.entry("BUY",strategy&.long,when=buycondition)
strategy&.close("BUY",when=sellcondition)
strategy&.exit("BUY",stop=stopLoss)
설명
//@version=4
strategy("전갤전략")
buycondition = rsi(close,14) < 30
sellcondition = rsi(close,14) > 70
stopLoss = strategy&.position_avg_price *0.90
strategy&.entry("BUY",strategy&.long,when=buycondition)
buy조건이 만족했을때 long진입한다는 조건이다
strategy&.close("BUY",when=sellcondition)
sell조건이 만족했을때 sell한다는 조건이다
strategy&.exit("BUY",stop=stopLoss)
stoploss 조건이 만족했을때 손절한다는 조건이다

?? 테스팅 결과가 이상하다
"당황한 전붕쿤"
당황하지말고 전략의 설정을 바꿔주자
이것을
이렇게 1배 롱 몰빵으로 설정해주자
하지만 이렇게 수동으로 설정하면 다른 종목을 확인할때 귀찮지 않나
이런 전략 설정을 파인스크립트로도 설정가능하다
첫문단에 default_qty_type=strategy&.percent_of_equity, default_qty_value=100 를 추가해주자
//@version=4
strategy("전갤전략",default_qty_type=strategy&.percent_of_equity, default_qty_value=100 )
buycondition = rsi(close,14) < 30
sellcondition = rsi(close,14) > 70
stopLoss = strategy&.position_avg_price *0.90
strategy&.entry("BUY",strategy&.long,when=buycondition)
strategy&.close("BUY",when=sellcondition)
strategy&.exit("BUY",stop=stopLoss)
그런데 바이낸스는 시장가 지를때 수수료를 내지 않나? 수수료랑 슬리피지를 추가해주자 바이낸스 시장가 수수료는 0.04이니 왕복 0.08
슬리피지 포함하여 0.1의 거래당 손실을 추가해주자
commission_type=strategy&.commission&.percent, commission_value=0.05
편도 0.04 슬리피지 0.01 포함 =0.05 왕복&이니 0.1
//@version=4
strategy("전갤전략",default_qty_type=strategy&.percent_of_equity, default_qty_value=100 ,commission_type=strategy&.commission&.percent, commission_value=0.05 )
buycondition = rsi(close,14) < 30
sellcondition = rsi(close,14) > 70
stopLoss = strategy&.position_avg_price *0.90
strategy&.entry("BUY",strategy&.long,when=buycondition)
strategy&.close("BUY",when=sellcondition)
strategy&.exit("BUY",stop=stopLoss)
rsi 30이하일때 매수 rsi 70이상일때 매도 스탑로스 -10% 왕복 수수료+슬리피지 0.1의 전략이다
결과를보자
수수료와 슬리피지를 포함시키고 승률 68.18% 손익비 0.588의 전략을 완성했다 그렇게 좋지도 나쁘지도 않은 전략이지만 이익을 보는 간단한 로직의 rsi전략이긴 하다
전붕이들도 공부해서 좋은 전략을 만들어보자
이 사진은 글쓴이 본인 전략의 테스팅 결과이다
궁금한점 질문받는다
| No | 제목 | 닉네임 | 등록일 | 조회 |
|---|---|---|---|---|
| 204 | 캘핑 소소한 팁? | 후후 | 2020.10.27 | 641 |
| 203 |
알트 매매 팁 하나
|
프렉탈 | 2020.10.25 | 802 |
| 202 |
추세매매의 중요성
|
펑핑 | 2020.10.22 | 654 |
| 201 | 마진 말고 주식 관련글 하나투척 | 케케묵은지 | 2020.10.14 | 395 |
| 200 | 트레이딩뷰로 나만의 지표를 만들어보자 (커스텀지표) | 전략가 | 2020.10.09 | 952 |
| » |
트레이딩뷰 시그널,전략 만들어보기 (전략편)
|
전략가 | 2020.10.09 | 746 |
| 198 | 선물시장과 싸울 수 있다면 바꾸고 노력해야 할 것들 1 | 구속자 | 2020.10.06 | 462 |
| 197 | 뉴욕 골드만삭스에서 근무한 트레이더의 비법 | 숏인지 감수성 | 2020.09.23 | 811 |
| 196 | 트레이딩에 대한 여러가지 생각들 2 | 닮은꼴 | 2020.09.16 | 574 |
| 195 |
매매하긴 두렵고 놔두자니 아까울때 쓰는 바낸 금융상품
|
carrera | 2020.09.13 | 792 |
| 194 |
이평선 관련 대충 보는 법
|
우량범 | 2020.09.08 | 796 |
| 193 | 고배라서 죽는게 아니다 1 | 고배시로 | 2020.09.08 | 767 |
| 192 | 내 매매 원칙 모음 | 차갤러 | 2020.09.08 | 772 |
| 191 | 마진할때 컴퓨터 렉없이 하는방법(차트포함) | 구조대 도착 | 2020.09.05 | 730 |
| 190 | 기술적 분석을 알아가는 과정 | about_the_lions | 2020.08.31 | 482 |
| 189 | 매매 일지 투척 | 차갤러 | 2020.08.30 | 204 |
| 188 | 번트를 치자 | 몽지몽지 | 2020.08.28 | 387 |
| 187 | tip: 손익비 관리 | bot | 2020.08.27 | 663 |
| 186 | 고통과 고민 덩어리 마진 | 덩어리 | 2020.08.25 | 555 |
| 185 |
개인적인 오렌드 단타 매매법 공유함
2
|
지옥의빗자루 | 2020.08.24 | 1622 |