커뮤니티
수식요청 드립니다.
2019-03-18 08:32:03
321
글번호 127128
* 항상 많은 도움에 정말 고맙습니다.
* 아래 수식중 청산 로직 좀 수정 요청 드립니다. (질문 4건)
var1= ma(c,5);
var2= ma(c,20);
if CrossUp(var1,var2) then buy();
if CrossDown(var1,var2) Then sell();
################# 청산 로직 질문 사항 입니다.###################################
Input : 익절틱수(20),손절틱수(20);
if Crossup(ma(c,3),ma(c,7)) Then { value1 = C; }
if Crossup(ma(c,10),ma(c,20)) Then { value2 = C; }
if CrossDown(ma(c,10),ma(c,20)) Then { value3 = C; }
if CrossDown(ma(c,10),ma(c,30)) Then { value4 = C; }
## 문의사항: 매매(매수,매도)후 청산
질문1번: if MarketPosition == 1 일경우 현재가격이 매수가격 보다 20틱 크고(이익)
현재가 가격이 이평선(ma(c,30)) 보다 크면 10일선이 30일선 다운되면서
청산(최대수익)
<공부용> if MarketPosition == 1 and c>Entryprice*익절틱수 and c>ma(c,30) Then { ExitLong("매수익절", crossdown(c,value4) } ◀ 이부분 수정 요청 좀 드립니다.
질문 2번: if MarketPosition == 1 일경우 현재가격이 매수가격 보다 10틱 작고(손실) 현재가 가격이 이평선(ma(c,30)) 보다
작으면 3일선이 7일선 다운되면 청산(최소손실)
<공부용> if MarketPosition == 1 and c<Entryprice*10 and c<ma(c,30) Then { ExitLong("매수손절", crossdown(c,value1) } ◀ 수정 요청 드립니다.
## 재매수 부분
Input : 익절틱수(20),손절틱수(20);
if Crossup(ma(c,3),ma(c,7)) Then { value1 = C; }
if Crossup(ma(c,10),ma(c,20)) Then { value2 = C; }
if CrossDown(ma(c,10),ma(c,20)) Then { value3 = C; }
if CrossDown(ma(c,10),ma(c,30)) Then { value4 = C; }
if MarketPosition == 1 and c<Entryprice*5 and c<value4 Then { ExitLong("매수익절",atlimit, EntryPrice + PriceScale*익절틱수);
## 5틱이상손실이고 이평선이 하락하면 청산
ExitLong("매수손절",AtStop , EntryPrice - PriceScale*손절틱수);
## 5틱이상손실이고 이평선이 상승하면 청산
}
if MarketPosition== -1 and c>Entryprice*5 and c<value4 Then { ExitShort("매도익절",atlimit, EntryPrice - PriceScale*익절틱수);
#20틱 수익이면 즉시 청산
ExitShort("매도손절",AtStop , EntryPrice + PriceScale*손절틱수);
#20틱 손실이면 즉시 청산
}
질문3번: 아래 로직에서 청산후 재매매(매수, 매도) 할려고 하는데 매매가 안됨니다. 뭐를 잘못 했나요??
.의미: 청산후 "매수익절" 했으면 매도로 스위칭 "매수손절" 했으면 매수로 스위칭 할려고 합니다.
if MarketPosition == 0 Then { if IsEntryName("매수익절") == true Then { if c<value2 Then sell("재매도"); }}
if MarketPosition == 0 Then { if IsEntryName("매수손절") == true Then { if c<value2 Then buy("재매수"); }}
질문 4번: 명칭에 따른 수익 청산 명령어가 안되는데 수식좀 봐주십시요.
.의미: 재매수 한것은 10틱 수익후 무조건 청산 입니다.
if MarketPosition == 1 and IsEntryName("재매도") == true then {ExitShort("sx1",AtStop,EntryPrice+PriceScale*10);}
if MarketPosition == 1 and IsEntryName("재매수") == true then {ExitLong("sx2",AtStop,EntryPrice+PriceScale*10);}
* 수고하십시요.
답변 1
예스스탁 예스스탁 답변
2019-03-18 15:51:40
안녕하세요
예스스탁입니다.
1
if MarketPosition == 1 and C >= EntryPrice+PriceScale*익절틱수 and C > ma(C,30) and CrossDown(ma(c,10),ma(C,30)) Then
ExitLong();
2
if MarketPosition == 1 and C <= EntryPrice-PriceScale*10 and C < ma(C,30) and CrossDown(ma(C,3),ma(C,7)) Then
ExitLong();
3
IsEntryName("매수익절")은 현재 진행중인 포지션의 이름입니다.
청산된 직전 진입의 명칭은 IsEntryName("매수익절",1)와 같이 매개변수 추가로 지정하셔야 합니다.
if MarketPosition == 0 and IsEntryName("매수익절",1) == true and c<value2 Then sell("재매도"); }}
if MarketPosition == 0 and IsEntryName("매수손절",1) == true and c<value2 Then buy("재매수"); }}
4
수식에 이상이 없습니다.
즐거운 하루되세요
> 요타 님이 쓴 글입니다.
> 제목 : 수식요청 드립니다.
> * 항상 많은 도움에 정말 고맙습니다.
* 아래 수식중 청산 로직 좀 수정 요청 드립니다. (질문 4건)
var1= ma(c,5);
var2= ma(c,20);
if CrossUp(var1,var2) then buy();
if CrossDown(var1,var2) Then sell();
################# 청산 로직 질문 사항 입니다.###################################
Input : 익절틱수(20),손절틱수(20);
if Crossup(ma(c,3),ma(c,7)) Then { value1 = C; }
if Crossup(ma(c,10),ma(c,20)) Then { value2 = C; }
if CrossDown(ma(c,10),ma(c,20)) Then { value3 = C; }
if CrossDown(ma(c,10),ma(c,30)) Then { value4 = C; }
## 문의사항: 매매(매수,매도)후 청산
질문1번: if MarketPosition == 1 일경우 현재가격이 매수가격 보다 20틱 크고(이익)
현재가 가격이 이평선(ma(c,30)) 보다 크면 10일선이 30일선 다운되면서
청산(최대수익)
<공부용> if MarketPosition == 1 and c>Entryprice*익절틱수 and c>ma(c,30) Then { ExitLong("매수익절", crossdown(c,value4) } ◀ 이부분 수정 요청 좀 드립니다.
질문 2번: if MarketPosition == 1 일경우 현재가격이 매수가격 보다 10틱 작고(손실) 현재가 가격이 이평선(ma(c,30)) 보다
작으면 3일선이 7일선 다운되면 청산(최소손실)
<공부용> if MarketPosition == 1 and c<Entryprice*10 and c<ma(c,30) Then { ExitLong("매수손절", crossdown(c,value1) } ◀ 수정 요청 드립니다.
## 재매수 부분
Input : 익절틱수(20),손절틱수(20);
if Crossup(ma(c,3),ma(c,7)) Then { value1 = C; }
if Crossup(ma(c,10),ma(c,20)) Then { value2 = C; }
if CrossDown(ma(c,10),ma(c,20)) Then { value3 = C; }
if CrossDown(ma(c,10),ma(c,30)) Then { value4 = C; }
if MarketPosition == 1 and c<Entryprice*5 and c<value4 Then { ExitLong("매수익절",atlimit, EntryPrice + PriceScale*익절틱수);
## 5틱이상손실이고 이평선이 하락하면 청산
ExitLong("매수손절",AtStop , EntryPrice - PriceScale*손절틱수);
## 5틱이상손실이고 이평선이 상승하면 청산
}
if MarketPosition== -1 and c>Entryprice*5 and c<value4 Then { ExitShort("매도익절",atlimit, EntryPrice - PriceScale*익절틱수);
#20틱 수익이면 즉시 청산
ExitShort("매도손절",AtStop , EntryPrice + PriceScale*손절틱수);
#20틱 손실이면 즉시 청산
}
질문3번: 아래 로직에서 청산후 재매매(매수, 매도) 할려고 하는데 매매가 안됨니다. 뭐를 잘못 했나요??
.의미: 청산후 "매수익절" 했으면 매도로 스위칭 "매수손절" 했으면 매수로 스위칭 할려고 합니다.
if MarketPosition == 0 Then { if IsEntryName("매수익절") == true Then { if c<value2 Then sell("재매도"); }}
if MarketPosition == 0 Then { if IsEntryName("매수손절") == true Then { if c<value2 Then buy("재매수"); }}
질문 4번: 명칭에 따른 수익 청산 명령어가 안되는데 수식좀 봐주십시요.
.의미: 재매수 한것은 10틱 수익후 무조건 청산 입니다.
if MarketPosition == 1 and IsEntryName("재매도") == true then {ExitShort("sx1",AtStop,EntryPrice+PriceScale*10);}
if MarketPosition == 1 and IsEntryName("재매수") == true then {ExitLong("sx2",AtStop,EntryPrice+PriceScale*10);}
* 수고하십시요.
다음글
이전글