커뮤니티
문의드립니다.
2018-08-16 20:53:49
211
글번호 121388
도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다.
1. 기타
아래식은 dayhigh와 daylow가 고정되있고 dayopen도 거래소에서 지정한 시간으로 돼 있습니다.
[전일고가시간] [전일저가시간] [시작설정시간]
각각의 값을 특정시간값으로 바꿔서 국선 해선에 다 적용할 수 있도록 코드 수정부탁드립니다.
//출처 : 7th감각 시스템트레이딩, p343
input : len(0.37), atrlen(50), len1(3), len2(2.2), len3(2.9), break(3), level(0.5), big(8);
# 기초진입전략
Var1 = dayHigh(1)-dayLow(1);
Condition1= date==exitdate(1) And marketposition(1)==1; //최근청산날짜가 금일이고 직전이 매수
Condition2= date==exitdate(1) And marketposition(1)==-1;//최근청산날짜가 금일이고 직전이 매도
If stime<150000 then {
IF Condition1==false and MarketPosition<>1 then
buy("매수",ATstop,dayOpen(0)+var1*len);
IF Condition2==false and MarketPosition<>-1 then
sell("매도",ATstop,dayOpen(0)-var1*len);
}
# Range5stop1 매수청산전략
Var2=high-low;
Var3=ma(Var2,atrlen);
IF marketposition==1 then {
Var50 = highest(high,BarsSinceEntry+1);
Exitlong("매수추적",Atstop,Var50-var3*len1);
Exitlong("매수변동성",Atstop,close-var3*len2);
If Var50>= Entryprice+var3*break then {
Exitlong("매수손익분기",ATstop,Entryprice+Var3*level);
Exitlong("매수추적1",Atstop,Var50-var3*len3);
}
IF Var50>=Entryprice+var3*big then
exitlong("매수초과수익",ATstop,lowest(low,3));
}
# Range5stop1 매도청산전략
IF marketposition==-1 then {
Var50 = lowest(low,BarsSinceEntry+1);
Exitshort("매도추적",Atstop,Var50+var3*len1);
Exitshort("매도변동성",Atstop,close+var3*len2);
If Var50>= Entryprice-var3*break then {
Exitshort("매도손익분기",ATstop,Entryprice-Var3*level);
Exitshort("매도추적1",Atstop,Var50+var3*len3);
}
IF Var50>=Entryprice-var3*big then
exitshort("매도초과수익",ATstop,highest(high,3));
}
2. 지표
-60분봉 절대값의 200개 평균이
-당일시가대비 몇프로인지 출력
3. 기타
하나의 전략에서
buy일 때는 수량 1
sell일 때는 수량을 [수량]으로 조절할 수 있도록 코딩 부탁드립니다.
4. 기타
외부변수 [진입옵션] 0,1,2
0일 경우 홀수 짝수날 다 진입
1일 경우 홀수날만 진입
2일 경우 짝수날만 진입
해선 국선 모두 다 입힐 수 있도록
코딩 부탁드립니다.
답변 1
예스스탁 예스스탁 답변
2018-08-17 10:45:50
안녕하세요
예스스탁입니다.
1
input : len(0.37), atrlen(50), len1(3), len2(2.2), len3(2.9), break(3), level(0.5), big(8);
input : 고가시간(90000),저가시간(90000),시작설정시간(90000),종료설정시간(150000);
var : HH(0),H1(0),LL(0),L1(0),dd(0),Tcond(false);
if (sdate != sdate[1] and stime >= 고가시간) or
(sdate == sdate[1] and stime >= 고가시간 and stime[1] < 고가시간) Then
{
HH = H;
H1 = HH[1];
}
if H > HH Then
HH = H;
if (sdate != sdate[1] and stime >= 저가시간) or
(sdate == sdate[1] and stime >= 저가시간 and stime[1] < 저가시간) Then
{
LL = L;
L1 = LL[1];
}
if L < LL Then
LL = L;
if (sdate != sdate[1] and stime >= 시작설정시간) or
(sdate == sdate[1] and stime >= 시작설정시간 and stime[1] < 시작설정시간) Then
{
Tcond = true;
DD = sdate;
}
if (sdate != sdate[1] and stime >= 종료설정시간) or
(sdate == sdate[1] and stime >= 종료설정시간 and stime[1] < 종료설정시간) Then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
# 기초진입전략
Var1 = H1-L1;
Condition1= dd==exitdate(1) And marketposition(1)==1; //최근청산날짜가 금일이고 직전이 매수
Condition2= dd==exitdate(1) And marketposition(1)==-1;//최근청산날짜가 금일이고 직전이 매도
If Tcond == true then {
IF Condition1==false and MarketPosition<>1 then
buy("매수",ATstop,dayOpen(0)+var1*len);
IF Condition2==false and MarketPosition<>-1 then
sell("매도",ATstop,dayOpen(0)-var1*len);
}
# Range5stop1 매수청산전략
Var2=high-low;
Var3=ma(Var2,atrlen);
IF marketposition==1 then {
Var50 = highest(high,BarsSinceEntry+1);
Exitlong("매수추적",Atstop,Var50-var3*len1);
Exitlong("매수변동성",Atstop,close-var3*len2);
If Var50>= Entryprice+var3*break then {
Exitlong("매수손익분기",ATstop,Entryprice+Var3*level);
Exitlong("매수추적1",Atstop,Var50-var3*len3);
}
IF Var50>=Entryprice+var3*big then
exitlong("매수초과수익",ATstop,lowest(low,3));
}
# Range5stop1 매도청산전략
IF marketposition==-1 then {
Var50 = lowest(low,BarsSinceEntry+1);
Exitshort("매도추적",Atstop,Var50+var3*len1);
Exitshort("매도변동성",Atstop,close+var3*len2);
If Var50>= Entryprice-var3*break then {
Exitshort("매도손익분기",ATstop,Entryprice-Var3*level);
Exitshort("매도추적1",Atstop,Var50+var3*len3);
}
IF Var50>=Entryprice-var3*big then
exitshort("매도초과수익",ATstop,highest(high,3));
}
2
var1 = data2(ma(H-L,200))/DayOpen*100;
plot1(var1);
3
input : 매수수량(1),매도수량(1);
if 매수진입조건 Then
buy("b",OnClose,def,매수수량);
if 매도진입조건 Then
sell("s",OnClose,def,매도수량);
4
input : N(0);
var : entry(false);
entry = false;
if N == 0 Then
entry = true;
if N == 1 and sdate%2 != 0 Then
entry = true;
if N == 2 and sdate%2 == 0 Then
entry = true;
if entry == true then
{
진입청산수식
}
즐거운 하루되세요
> 잡다백수 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다.
1. 기타
아래식은 dayhigh와 daylow가 고정되있고 dayopen도 거래소에서 지정한 시간으로 돼 있습니다.
[전일고가시간] [전일저가시간] [시작설정시간]
각각의 값을 특정시간값으로 바꿔서 국선 해선에 다 적용할 수 있도록 코드 수정부탁드립니다.
//출처 : 7th감각 시스템트레이딩, p343
input : len(0.37), atrlen(50), len1(3), len2(2.2), len3(2.9), break(3), level(0.5), big(8);
# 기초진입전략
Var1 = dayHigh(1)-dayLow(1);
Condition1= date==exitdate(1) And marketposition(1)==1; //최근청산날짜가 금일이고 직전이 매수
Condition2= date==exitdate(1) And marketposition(1)==-1;//최근청산날짜가 금일이고 직전이 매도
If stime<150000 then {
IF Condition1==false and MarketPosition<>1 then
buy("매수",ATstop,dayOpen(0)+var1*len);
IF Condition2==false and MarketPosition<>-1 then
sell("매도",ATstop,dayOpen(0)-var1*len);
}
# Range5stop1 매수청산전략
Var2=high-low;
Var3=ma(Var2,atrlen);
IF marketposition==1 then {
Var50 = highest(high,BarsSinceEntry+1);
Exitlong("매수추적",Atstop,Var50-var3*len1);
Exitlong("매수변동성",Atstop,close-var3*len2);
If Var50>= Entryprice+var3*break then {
Exitlong("매수손익분기",ATstop,Entryprice+Var3*level);
Exitlong("매수추적1",Atstop,Var50-var3*len3);
}
IF Var50>=Entryprice+var3*big then
exitlong("매수초과수익",ATstop,lowest(low,3));
}
# Range5stop1 매도청산전략
IF marketposition==-1 then {
Var50 = lowest(low,BarsSinceEntry+1);
Exitshort("매도추적",Atstop,Var50+var3*len1);
Exitshort("매도변동성",Atstop,close+var3*len2);
If Var50>= Entryprice-var3*break then {
Exitshort("매도손익분기",ATstop,Entryprice-Var3*level);
Exitshort("매도추적1",Atstop,Var50+var3*len3);
}
IF Var50>=Entryprice-var3*big then
exitshort("매도초과수익",ATstop,highest(high,3));
}
2. 지표
-60분봉 절대값의 200개 평균이
-당일시가대비 몇프로인지 출력
3. 기타
하나의 전략에서
buy일 때는 수량 1
sell일 때는 수량을 [수량]으로 조절할 수 있도록 코딩 부탁드립니다.
4. 기타
외부변수 [진입옵션] 0,1,2
0일 경우 홀수 짝수날 다 진입
1일 경우 홀수날만 진입
2일 경우 짝수날만 진입
해선 국선 모두 다 입힐 수 있도록
코딩 부탁드립니다.
다음글