커뮤니티
수식 부탁드립니다.
2018-05-15 09:20:30
185
글번호 118901
수식 추가 부탁드립니다.
매수 진입 후
종가가 200선대비 n(50)틱이상 크게되는 ●(빨간색)이 나타나기 전에
200선 상향돌파 되는 ■(빨간색)이 3번(A번)이상 나타나면 매수포지션 청산
매도(반대)
종가가 200선대비 n(50)틱이상 작게되는 ●(파란색)이 나타나기 전에
200선 하향돌파 되는 ■(파란색)이 3번(A번)이상 나타나면 매도포지션 청산
input : n(50);
var : t(0),t1(0),tx(0),tl(0);
var1 = ma(c,20);
var2 = ma(C,200);
#200선 상향돌파
if Crossup(C,var2) Then
{
#t는 1
t = 1;
#이전구간(하향이탈구간) t값은 t1에 저장
t1 = t[1];
#■출력
tx = Text_New(sdate,stime,H+PriceScale,"■");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
#매수주문을 구간에 한번하기 위한 변수
Condition1 = false;
}
#200선 하향이탈
if CrossDown(C,var2) Then
{
#t는 -1
t = -1;
#이전구간(상향돌파구간) t값은 t1에 저장
t1 = t[1];
#■출력
tx = Text_New(sdate,stime,L-PriceScale,"■");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
#매도주문을 구간에 한번하기 위한 변수
Condition2 = false;
}
#t가 1일때 종가가 200선대비 n틱이상 크게되면
if t == 1 and c > var2+PriceScale*n Then
{
#t는 2로 변경
t = 2;
#●출력
tx = Text_New(sdate,stime,H+PriceScale,"●"+NumToStr(C,2));
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
}
#t가 -1일때 종가가 200선대비 n틱이상 작게되면
if t == -1 and c < var2-PriceScale*n Then{
#t는 -2로 변경
t = -2;
#●출력
tx = Text_New(sdate,stime,L-PriceScale,"●"+NumToStr(C,2));
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
}
# 200선 상향돌파하고 직전구간(하향이탈구간) t가 -2까지 기록했으면
if crossup(t,0) and t1 <= -2 Then
{
#★출력
tx = Text_New(sdate,stime,H+PriceScale*3,"★");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
}
# 200선 하향이탈하고 직전구간(상향돌파구간) t가 2까지 기록했으면
if CrossDown(t,0) and t1 >= 2 Then
{
#★출력
tx = Text_New(sdate,stime,L-PriceScale*3,"★");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
}
#200선 상향돌파한 구간이고
#직전 햐향이탈한 구간은 t는 -2까지 기록했고
#현재10선이 200선보다 크면 매수
if Condition1 == false and t > 0 and t1 <= -2 and var1 > var2 Then{
Condition1 = true;
buy();
}
#200선 하향이탈한 구간이고
#직전구간(상향돌파구간)애서 t는 2까지 기록했고
#현재10선이 200선보다 작으면 매도
if Condition2 == false and t < 0 and t1 >= 2 and var1 < var2 Then{
Condition2 = true;
sell();
}
답변 1
예스스탁 예스스탁 답변
2018-05-15 14:00:52
안녕하세요
예스스탁입니다.
input : n(50);
var : t(0),t1(0),tx(0),tl(0);
var1 = ma(c,20);
var2 = ma(C,200);
#200선 상향돌파
if Crossup(C,var2) Then
{
#t는 1
t = 1;
#이전구간(하향이탈구간) t값은 t1에 저장
t1 = t[1];
#■출력
tx = Text_New(sdate,stime,H+PriceScale,"■");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
#매수주문을 구간에 한번하기 위한 변수
Condition1 = false;
}
#200선 하향이탈
if CrossDown(C,var2) Then
{
#t는 -1
t = -1;
#이전구간(상향돌파구간) t값은 t1에 저장
t1 = t[1];
#■출력
tx = Text_New(sdate,stime,L-PriceScale,"■");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
#매도주문을 구간에 한번하기 위한 변수
Condition2 = false;
}
#t가 1일때 종가가 200선대비 n틱이상 크게되면
if t == 1 and c > var2+PriceScale*n Then
{
#t는 2로 변경
t = 2;
#●출력
tx = Text_New(sdate,stime,H+PriceScale,"●"+NumToStr(C,2));
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
}
#t가 -1일때 종가가 200선대비 n틱이상 작게되면
if t == -1 and c < var2-PriceScale*n Then{
#t는 -2로 변경
t = -2;
#●출력
tx = Text_New(sdate,stime,L-PriceScale,"●"+NumToStr(C,2));
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
}
# 200선 상향돌파하고 직전구간(하향이탈구간) t가 -2까지 기록했으면
if crossup(t,0) and t1 <= -2 Then
{
#★출력
tx = Text_New(sdate,stime,H+PriceScale*3,"★");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
}
# 200선 하향이탈하고 직전구간(상향돌파구간) t가 2까지 기록했으면
if CrossDown(t,0) and t1 >= 2 Then
{
#★출력
tx = Text_New(sdate,stime,L-PriceScale*3,"★");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
}
#200선 상향돌파한 구간이고
#직전 햐향이탈한 구간은 t는 -2까지 기록했고
#현재10선이 200선보다 크면 매수
if Condition1 == false and t > 0 and t1 <= -2 and var1 > var2 Then{
Condition1 = true;
buy();
}
#200선 하향이탈한 구간이고
#직전구간(상향돌파구간)애서 t는 2까지 기록했고
#현재10선이 200선보다 작으면 매도
if Condition2 == false and t < 0 and t1 >= 2 and var1 < var2 Then{
Condition2 = true;
sell();
}
if MarketPosition == 1 and
crossup(c,var2) and
countif(crossup(c,var2),BarsSinceEntry) == 3 and
highest(C,BarsSinceEntry) < var2+PriceScale*n Then
exitlong("bx");
if MarketPosition == -1 and
crossdown(c,var2) and
countif(CrossDown(c,var2),BarsSinceEntry) == 3 and
lowest(C,BarsSinceEntry) > var2-PriceScale*n Then
ExitShort("sx");
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다.
> 수식 추가 부탁드립니다.
매수 진입 후
종가가 200선대비 n(50)틱이상 크게되는 ●(빨간색)이 나타나기 전에
200선 상향돌파 되는 ■(빨간색)이 3번(A번)이상 나타나면 매수포지션 청산
매도(반대)
종가가 200선대비 n(50)틱이상 작게되는 ●(파란색)이 나타나기 전에
200선 하향돌파 되는 ■(파란색)이 3번(A번)이상 나타나면 매도포지션 청산
input : n(50);
var : t(0),t1(0),tx(0),tl(0);
var1 = ma(c,20);
var2 = ma(C,200);
#200선 상향돌파
if Crossup(C,var2) Then
{
#t는 1
t = 1;
#이전구간(하향이탈구간) t값은 t1에 저장
t1 = t[1];
#■출력
tx = Text_New(sdate,stime,H+PriceScale,"■");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
#매수주문을 구간에 한번하기 위한 변수
Condition1 = false;
}
#200선 하향이탈
if CrossDown(C,var2) Then
{
#t는 -1
t = -1;
#이전구간(상향돌파구간) t값은 t1에 저장
t1 = t[1];
#■출력
tx = Text_New(sdate,stime,L-PriceScale,"■");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
#매도주문을 구간에 한번하기 위한 변수
Condition2 = false;
}
#t가 1일때 종가가 200선대비 n틱이상 크게되면
if t == 1 and c > var2+PriceScale*n Then
{
#t는 2로 변경
t = 2;
#●출력
tx = Text_New(sdate,stime,H+PriceScale,"●"+NumToStr(C,2));
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
}
#t가 -1일때 종가가 200선대비 n틱이상 작게되면
if t == -1 and c < var2-PriceScale*n Then{
#t는 -2로 변경
t = -2;
#●출력
tx = Text_New(sdate,stime,L-PriceScale,"●"+NumToStr(C,2));
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
}
# 200선 상향돌파하고 직전구간(하향이탈구간) t가 -2까지 기록했으면
if crossup(t,0) and t1 <= -2 Then
{
#★출력
tx = Text_New(sdate,stime,H+PriceScale*3,"★");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
}
# 200선 하향이탈하고 직전구간(상향돌파구간) t가 2까지 기록했으면
if CrossDown(t,0) and t1 >= 2 Then
{
#★출력
tx = Text_New(sdate,stime,L-PriceScale*3,"★");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
}
#200선 상향돌파한 구간이고
#직전 햐향이탈한 구간은 t는 -2까지 기록했고
#현재10선이 200선보다 크면 매수
if Condition1 == false and t > 0 and t1 <= -2 and var1 > var2 Then{
Condition1 = true;
buy();
}
#200선 하향이탈한 구간이고
#직전구간(상향돌파구간)애서 t는 2까지 기록했고
#현재10선이 200선보다 작으면 매도
if Condition2 == false and t < 0 and t1 >= 2 and var1 < var2 Then{
Condition2 = true;
sell();
}