답변완료
수식오류 확인 요청드립니다.
항상 고생이 많으십니다 ^^
일전에 주신 수식을 참고하여
CrossUp(C,고점[1,1])으로 적용하고 싶은데
시뮬레이션에서 작동을 안합니다.
(전략 : 저점이 높아졌을 경우 전고점을 돌파하면 매수)
어떤 오류때문에 작동을 안하는지 알고싶습니다.
if MarketPosition <= 0 and T == -1
and CrossUp(C,고점[1,1])
and 저점[1,1] > 저점[2,1]
Then
Buy("b2",AtStop,고점[1,1]);
#Buy("b2");
/*
Input:length(10);
Var: 전환포인트(0)
,고(1),저(-1),신규(1),연장(2),연속(3),삼선(4);
Array:고점[10,44](0),저점[10,44](0), // 열번호 : 1=가격,2=Index,3=sDate,4=sTime,11=가격,12=Index,13=sDate,14=sTime
최종상태[5](0);
# ,처리구분[5](0);
//=========================================================//
Value1 = study_zigzag_01(length, H, L);
*/
#If
# and
/*
If c > ma(C,20) and c > ma(C,60)
and CrossUp(c, ma(c,5))
and Value1 == 저
# CrossUp(C,고점[1,1])
Then {
Buy("고점돌파");
}
*/
/*
If 전환포인트 == 고
# and CrossDown(C,저점[1,1])
Then {
#Sell("저점이탈");
exitlong("매수청산");
}
*/
/*
If #전환포인트 == 저 and
CrossUp(C,MA(C,20)) ##고점[1,1])
Then {
Buy("고점돌파");
}
*/
/*
If 전환포인트 == 고
#and CrossDown(C,저[1,1])
Then {
#Sell("저점이탈");
exitlong("매수청산");
}
*/
/*
Input:왼쪽기간(5),오른쪽기간(5),레벨(0);
Var:고점(1),저점(-1),신규(1),연장(2),연속(3),삼선(4);
Array:고[10,44](0),저[10,44](0), // 열번호 : 1=가격,2=Index,3=sDate,4=sTime,11=가격,12=Index,13=sDate,14=sTime
최종상태[5](0),처리구분[5](0);
//=========================================================//
Var1 = 레벨 * 10;
Value1 = SwingZigZag301(H,L,왼쪽기간,오른쪽기간,고,저,최종상태,처리구분);
# 매수/매수청산
If c > ma(C,20) and c > ma(C,60)
and CrossUp(c, ma(c,5)) Then
# and CrossUp(ma(c,5), ma(c,20)) Then
{
Buy("매수진입");
}
If c > ma(C,20)
and CrossDown(c, ma(c,5)) Then
# and CrossDown(ma(c,5), ma(c,20)) Then
{
exitlong("매수청산");
}
/*
If
c > ma(C,20)
and 최종상태[레벨] == 저점 and CrossUp(C,고[1,Var1 + 1]) Then {
Buy("고점돌파");
}
If 최종상태[레벨] == 고점 and CrossDown(C,저[1,Var1 + 1]) Then {
#Sell("저점이탈");
exitlong("매수청산");
}
*/
Input:length(10);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),Text1(0),처리구분(""); #전환포인트(0), 저점확인(-1), 고점확인(1);
var:d1(0),t1(0),t(0);
Array:고점[10,2](0),저점[10,2](0); //가격,위치
#처리구분 = "";
If Highest(H,length) == H and lastHiVal <> H and
Lowest(L,length) == L and lastLoVal <> L Then
{
If 저점[1,1] > L Then 처리구분 = "저점처리";
If 고점[1,1] < H Then 처리구분 = "고점처리";
}
Else If Highest(H,length) == H and lastHiVal <> H Then
처리구분 = "고점처리";
Else If Lowest(L,length) == L and lastLoVal <> L Then
처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
T = 1;
lastHiVal = H;
If 고점[1,2] < 저점[1,2] Then
{
For j = 10 DownTo 2
{
고점[j,1] = 고점[j-1,1];
고점[j,2] = 고점[j-1,2];
}
}
If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then
{
고점[1,1] = H;
고점[1,2] = Index;
sBar = Index - 저점[1,2];
eBar = 0;
If d1 == sDate[sBar] and
t1 == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
d1 = sDate[sBar];
t1 = stime[sBar];
#전환포인트 = 고점확인;
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(고점[1,1],2));
Text_SetStyle(Text1, 2, 1);
}
}
If 처리구분 == "저점처리" Then
{
t = -1;
lastLoVal = L;
If 저점[1,2] < 고점[1,2] then
{
For j = 10 DownTo 2
{
저점[j,1] = 저점[j-1,1];
저점[j,2] = 저점[j-1,2];
}
}
If 저점[1,2] < 고점[1,2] or 저점[1,1] > L then
{
저점[1,1] = L;
저점[1,2] = Index;
sBar = Index - 고점[1,2];
eBar = 0;
If d1 == sDate[sBar] and
t1 == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
d1 = sDate[sBar];
t1 = stime[sBar];
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(저점[1,1],2));
Text_SetStyle(Text1, 2, 0);
}
}
TL_SetSize(TL1,3);
TL_SetColor(TL1,CYAN);
if MarketPosition <= 0 and T == -1
and CrossUp(C,고점[1,1])
#and C < 고점[1,1]
and 저점[1,1] > 저점[2,1]
Then
Buy("b2",AtStop,고점[1,1]);
#Buy("b2");
if MarketPosition == 1 Then
ExitLong("bx",AtStop,저점[1,1][BarsSinceEntry]);
2022-03-08
1164
글번호 157009
시스템