예스스탁
예스스탁 답변
2020-03-10 14:31:32
안녕하세요
예스스탁입니다.
수식에 스위칭(청산후 반대포지션으로 진입)하는 내용이 있습니다.
스위칭에 진입횟수 제한 추가해 드립니다.
1
input : 매수음봉틱수(5),매수양봉틱수(5);
input : 매도양봉틱수(5),매도음봉틱수(5);
input : 진입횟수(5);
input : 익절틱수(50),손절틱수(50);
input : P1(5),P2(20);
var : entry(0),mav1(0),mav2(0);
mav1 = ma(C,P1);
mav2 = ma(C,P2);
#영업일 변경
if bdate != bdate[1] Then
entry = 0;
#포지션이 변경되어 새로운 진입포지션 발생시마다 1씩 증가
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
if mav1 > mav2 and #정배열
entry < 진입횟수 and #진입횟수가 지정한 값 이하
MarketPosition == 0 and #매수나 무포지션 상태
C[1] == O[1]+매도양봉틱수*PriceScale and #1봉전종가가 1봉전시가+매도양봉틱수 이상
C[0] == O[0]-매도음봉틱수*PriceScale Then #현재봉 종가가 1봉전시가-매도음봉틱수 이하
sell("s");
if mav1 < mav2 and #역배열
entry < 진입횟수 and #진입횟수가 지정한 값 이하
MarketPosition == 0 and #매도나 무포지션 상태
C[1] == O[1]-매수음봉틱수*PriceScale and #1봉전종가가 1봉전시가-매수음봉틱수 이하
C[0] == O[0]+매수양봉틱수*PriceScale Then #현재봉 종가가 1봉전시가+매수양봉틱수 이상
buy("b");
#매수진입 후 손절되면 매도로 스위칭
if MarketPosition == 1 Then
{
if entry < 진입횟수 Then
sell("bs",AtStop,EntryPrice-PriceScale*손절틱수);
Else
ExitLong("bsx",AtStop,EntryPrice-PriceScale*손절틱수);
}
#매도진입 후 손절되면 매수로 스위칭
if MarketPosition == -1 and entry < 진입횟수 Then
{
if entry < 진입횟수 Then
buy("sb",AtStop,EntryPrice+PriceScale*손절틱수);
Else
ExitShort("sbx",AtStop,EntryPrice+PriceScale*손절틱수);
}
#목표수익 설정
SetStopProfittarget(PriceScale*익절틱수,PointStop);
3
input : 매수음봉틱수(5),매수양봉틱수(5);
input : 매도양봉틱수(5),매도음봉틱수(5);
input : 진입횟수(5);
input : 익절틱수(50),손절틱수(50);
var : entry(0);
#영업일 변경
if bdate != bdate[1] Then
entry = 0;
#포지션이 변경되어 새로운 진입포지션 발생시마다 1씩 증가
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
if entry < 진입횟수 and #진입횟수가 지정한 값 이하
MarketPosition == 0 and #매수나 무포지션 상태
C[1] == O[1]+매도양봉틱수*PriceScale and #1봉전종가가 1봉전시가+매도양봉틱수 이상
C[0] == O[0]-매도음봉틱수*PriceScale Then #현재봉 종가가 1봉전시가-매도음봉틱수 이하
sell("s");
if entry < 진입횟수 and #진입횟수가 지정한 값 이하
MarketPosition == 0 and #매도나 무포지션 상태
C[1] == O[1]-매수음봉틱수*PriceScale and #1봉전종가가 1봉전시가-매수음봉틱수 이하
C[0] == O[0]+매수양봉틱수*PriceScale Then #현재봉 종가가 1봉전시가+매수양봉틱수 이상
buy("b");
#매수진입 후 손절되면 매도로 스위칭
if MarketPosition == 1 Then
{
if entry < 진입횟수 Then
sell("bs",AtStop,EntryPrice-PriceScale*손절틱수);
Else
ExitLong("bsx",AtStop,EntryPrice-PriceScale*손절틱수);
}
#매도진입 후 손절되면 매수로 스위칭
if MarketPosition == -1 and entry < 진입횟수 Then
{
if entry < 진입횟수 Then
buy("sb",AtStop,EntryPrice+PriceScale*손절틱수);
Else
ExitShort("sbx",AtStop,EntryPrice+PriceScale*손절틱수);
}
#목표수익 설정
SetStopProfittarget(PriceScale*익절틱수,PointStop);
즐거운 하루되세요
> 대구어린울프 님이 쓴 글입니다.
> 제목 : 수정 부탁드립니다
> 안녕하세요?
아래의 두가지 수식이 하루 매매횟수가 맞질않습니다.
외부변수에서 1회로 설정해 놓아도 여러번 거래되는날이 많네요.
수정부탁드립니다.
감사합니다.
[1]
input : 매수음봉틱수(5),매수양봉틱수(5);
input : 매도양봉틱수(5),매도음봉틱수(5);
input : 진입횟수(5);
input : 익절틱수(50),손절틱수(50);
input : P1(5),P2(20);
var : entry(0),mav1(0),mav2(0);
mav1 = ma(C,P1);
mav2 = ma(C,P2);
#영업일 변경
if bdate != bdate[1] Then
entry = 0;
#포지션이 변경되어 새로운 진입포지션 발생시마다 1씩 증가
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
if mav1 > mav2 and #정배열
entry < 진입횟수 and #진입횟수가 지정한 값 이하
MarketPosition == 0 and #매수나 무포지션 상태
C[1] == O[1]+매도양봉틱수*PriceScale and #1봉전종가가 1봉전시가+매도양봉틱수 이상
C[0] == O[0]-매도음봉틱수*PriceScale Then #현재봉 종가가 1봉전시가-매도음봉틱수 이하
sell("s");
if mav1 < mav2 and #역배열
entry < 진입횟수 and #진입횟수가 지정한 값 이하
MarketPosition == 0 and #매도나 무포지션 상태
C[1] == O[1]-매수음봉틱수*PriceScale and #1봉전종가가 1봉전시가-매수음봉틱수 이하
C[0] == O[0]+매수양봉틱수*PriceScale Then #현재봉 종가가 1봉전시가+매수양봉틱수 이상
buy("b");
#매수진입 후 손절되면 매도로 스위칭
if MarketPosition == 1 Then
sell("bs",AtStop,EntryPrice-PriceScale*손절틱수);
#매도진입 후 손절되면 매수로 스위칭
if MarketPosition == -1 Then
buy("sb",AtStop,EntryPrice+PriceScale*손절틱수);
#목표수익 설정
SetStopProfittarget(PriceScale*익절틱수,PointStop);
[2]
input : 매수음봉틱수(5),매수양봉틱수(5);
input : 매도양봉틱수(5),매도음봉틱수(5);
input : 진입횟수(5);
input : 익절틱수(50),손절틱수(50);
var : entry(0);
#영업일 변경
if bdate != bdate[1] Then
entry = 0;
#포지션이 변경되어 새로운 진입포지션 발생시마다 1씩 증가
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
if entry < 진입횟수 and #진입횟수가 지정한 값 이하
MarketPosition == 0 and #매수나 무포지션 상태
C[1] == O[1]+매도양봉틱수*PriceScale and #1봉전종가가 1봉전시가+매도양봉틱수 이상
C[0] == O[0]-매도음봉틱수*PriceScale Then #현재봉 종가가 1봉전시가-매도음봉틱수 이하
sell("s");
if entry < 진입횟수 and #진입횟수가 지정한 값 이하
MarketPosition == 0 and #매도나 무포지션 상태
C[1] == O[1]-매수음봉틱수*PriceScale and #1봉전종가가 1봉전시가-매수음봉틱수 이하
C[0] == O[0]+매수양봉틱수*PriceScale Then #현재봉 종가가 1봉전시가+매수양봉틱수 이상
buy("b");
#매수진입 후 손절되면 매도로 스위칭
if MarketPosition == 1 Then
sell("bs",AtStop,EntryPrice-PriceScale*손절틱수);
#매도진입 후 손절되면 매수로 스위칭
if MarketPosition == -1 Then
buy("sb",AtStop,EntryPrice+PriceScale*손절틱수);
#목표수익 설정
SetStopProfittarget(PriceScale*익절틱수,PointStop);