커뮤니티
수식문의드려요^^
2016-07-25 22:48:12
156
글번호 100369
수식 검증은 되는데영..신호가 뜨지를 않어용..화살표 신호를 나오게 해주세요.^^
input : P1(5),P2(20),per(8);
var : mav1(0),mav2(0);
var : T1(0),cnt(0),count(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
mav1 = ma(c,P1);
mav2 = ma(c,P2);
if mav1 > mav1[1] Then
T1 = 1;
Else
T1 = -1;
if T1 == 1 and T1[1] != 1 Then{
if MarketPosition == 0 and count == 0 Then
buy();
if MarketPosition == 0 and count > 0 and (C >= ExitPrice(1)*(1+Per/100) or C <= ExitPrice(1-Per/100)) Then
buy();
}
if T1 == -1 and T1[1] != -1 Then{
if MarketPosition == 0 and count == 0 Then
sell();
if MarketPosition == 0 and count > 0 and (C >= ExitPrice(1)*(1+Per/100) or C <= ExitPrice(1-Per/100)) Then
sell();
}
if MarketPosition == 1 Then{
if CrossUp(mav1,mav2) Then{
Condition1 = true;
var1 = 0;
}
if Condition1 == true and mav1 > mav2 and T1 == -1 Then{
var1 = var1+1;
if var1 == 1 and C >= EntryPrice+PriceScale*20 Then
ExitLong("bx1");
if var2 == 2 Then
ExitLong("bx2");
}
}
if MarketPosition != 1 Then{
Condition1 = false;
var1 = 0;
}
if MarketPosition == -1 Then{
if CrossDown(mav1,mav2) Then{
Condition2 = true;
var2 = 0;
}
if Condition2 == true and mav1 < mav2 and T1 == 1 Then{
var2 = var2+1;
if var2 == 1 and C <= EntryPrice-PriceScale*20 Then
ExitShort("sx1");
if var2 == 2 Then
ExitShort("sx2");
}
}
if MarketPosition != -1 Then{
Condition2 = false;
var2 = 0;
}
SetStopProfittarget(PriceScale*8,PointStop);
SetStopLoss(PriceScale*12,PointStop);
감사합니다.^^
답변 1
예스스탁 예스스탁 답변
2016-07-26 14:34:06
안녕하세요
예스스탁입니다.
첨부된 그림과 같이 신호 많이 발생하고 있습니다.
선물 5분봉 5000봉에 적용한 결과입니다.
즐거운 하루되세요
> 천년의사랑 님이 쓴 글입니다.
> 제목 : 수식문의드려요^^
> 수식 검증은 되는데영..신호가 뜨지를 않어용..화살표 신호를 나오게 해주세요.^^
input : P1(5),P2(20),per(8);
var : mav1(0),mav2(0);
var : T1(0),cnt(0),count(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
mav1 = ma(c,P1);
mav2 = ma(c,P2);
if mav1 > mav1[1] Then
T1 = 1;
Else
T1 = -1;
if T1 == 1 and T1[1] != 1 Then{
if MarketPosition == 0 and count == 0 Then
buy();
if MarketPosition == 0 and count > 0 and (C >= ExitPrice(1)*(1+Per/100) or C <= ExitPrice(1-Per/100)) Then
buy();
}
if T1 == -1 and T1[1] != -1 Then{
if MarketPosition == 0 and count == 0 Then
sell();
if MarketPosition == 0 and count > 0 and (C >= ExitPrice(1)*(1+Per/100) or C <= ExitPrice(1-Per/100)) Then
sell();
}
if MarketPosition == 1 Then{
if CrossUp(mav1,mav2) Then{
Condition1 = true;
var1 = 0;
}
if Condition1 == true and mav1 > mav2 and T1 == -1 Then{
var1 = var1+1;
if var1 == 1 and C >= EntryPrice+PriceScale*20 Then
ExitLong("bx1");
if var2 == 2 Then
ExitLong("bx2");
}
}
if MarketPosition != 1 Then{
Condition1 = false;
var1 = 0;
}
if MarketPosition == -1 Then{
if CrossDown(mav1,mav2) Then{
Condition2 = true;
var2 = 0;
}
if Condition2 == true and mav1 < mav2 and T1 == 1 Then{
var2 = var2+1;
if var2 == 1 and C <= EntryPrice-PriceScale*20 Then
ExitShort("sx1");
if var2 == 2 Then
ExitShort("sx2");
}
}
if MarketPosition != -1 Then{
Condition2 = false;
var2 = 0;
}
SetStopProfittarget(PriceScale*8,PointStop);
SetStopLoss(PriceScale*12,PointStop);
감사합니다.^^
다음글
이전글