예스스탁
예스스탁 답변
2021-10-15 09:43:19
안녕하세요
예스스탁입니다.
수식에 기간을 지정해 주는 length에 대한 선언이 없었습니다.
외부변수로 추가해 드립니다.
input: 익절틱수(27),손절틱수(25),진입횟수(1),length(20);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0);
var:처리구분(""),TL_Val1(0),TL_Val2(0),color(0),T(0);
Array:고점[10,2](0),저점[10,2](0);
var:entry(0);
if Bdate !=Bdate[1] Then
entry=0;
if (MarketPosition !=0 and MarketPosition !=MarketPosition[1])or
(MarketPosition==MarketPosition[1] and TotalTrades>TotalTrades[1])Then
entry=entry+1;
처리구분="";
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 TL_GetBeginDate(TL1)==sDate[sBar] and TL_GetBeginTime(TL1)==sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 고점[3,1][1]< 고점[2,1][1] and 고점[2,1][1]> 고점[1,1][1]and 저점[2,1][1]< 저점[1,1][1] Then
TL_Delete(TL2);
}
if 고점[1,1]> 고점[2,1] or 고점[2,1] == 0 Then{
color= RED;
//buy("b");
}
TL1= TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL1,color);
Text1= Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],2));
Text_SetStyle(Text1,2,1);
If 고점[3,1]< 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then
{
sBar=Index-저점[2,2];
eBar=Index-저점[1,2];
}
}
}
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 TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 저점[2,1][1] < 저점[1,1][1] and 저점[2,1][1] < 저점[3,1][1] and 고점[2,1][1]> 고점[1,1][1] Then
TL_Delete(TL3);
}
if 저점[1,1] < 저점[2,1] or 저점[2,1] == 0 Then{
color = blue;
//sell("s");
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL1,color);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],2));
Text_SetStyle(Text1, 2, 0);
If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then
{
sBar = Index - 고점[2,2];
eBar = Index - 고점[1,2];
}
}
}
TL_SetSize(TL1,3);
if T == 1 and CrossUp(C,고점[2,1]) Then
{
if entry < 진입횟수 Then
Buy("b");
Else
ExitShort("sx");
}
if T == -1 and CrossUp(C,저점[2,1]) Then
{
if entry < 진입횟수 Then
Sell("s");
Else
ExitLong("bx");
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
> 하하아빠 님이 쓴 글입니다.
> 제목 : 수식점검
> 본 수식 점검해 주세요!
input: 익절틱수(27),손절틱수(25),진입횟수(1);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0);
var:처리구분(""),TL_Val1(0),TL_Val2(0),color(0),T(0);
Array:고점[10,2](0),저점[10,2](0);
var:entry(0);
if Bdate !=Bdate[1] Then
entry=0;
if (MarketPosition !=0 and MarketPosition !=MarketPosition[1])or
(MarketPosition==MarketPosition[1] and TotalTrades>TotalTrades[1])Then
entry=entry+1;
처리구분="";
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 TL_GetBeginDate(TL1)==sDate[sBar] and TL_GetBeginTime(TL1)==sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 고점[3,1][1]< 고점[2,1][1] and 고점[2,1][1]> 고점[1,1][1]and 저점[2,1][1]< 저점[1,1][1] Then
TL_Delete(TL2);
}
if 고점[1,1]> 고점[2,1] or 고점[2,1] == 0 Then{
color= RED;
//buy("b");
}
TL1= TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL1,color);
Text1= Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],2));
Text_SetStyle(Text1,2,1);
If 고점[3,1]< 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then
{
sBar=Index-저점[2,2];
eBar=Index-저점[1,2];
}
}
}
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 TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 저점[2,1][1] < 저점[1,1][1] and 저점[2,1][1] < 저점[3,1][1] and 고점[2,1][1]> 고점[1,1][1] Then
TL_Delete(TL3);
}
if 저점[1,1] < 저점[2,1] or 저점[2,1] == 0 Then{
color = blue;
//sell("s");
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL1,color);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],2));
Text_SetStyle(Text1, 2, 0);
If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then
{
sBar = Index - 고점[2,2];
eBar = Index - 고점[1,2];
}
}
}
TL_SetSize(TL1,3);
if T == 1 and CrossUp(C,고점[2,1]) Then
{
if entry < 진입횟수 Then
Buy("b");
Else
ExitShort("sx");
}
if T == -1 and CrossUp(C,저점[2,1]) Then
{
if entry < 진입횟수 Then
Sell("s");
Else
ExitLong("bx");
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
줄수 16과 21~22에 선언되지 않은 이름 'length'가 사용되었다고 하네요
도통 모르겠네요
미리 수고에 감사드려요!