답변완료
문의 드립니다.~~~~
계시판을 보며 나름 열심히 공부하고 있습니다.
아래식의 자세한 주석을 부탁드립니다.
Input:length(12);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0),처리구분(""),TL_Val1(0),TL_Val2(0),color(0);
var:T(0),B(0),Bx(0),S(0),Sx(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 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 Color == RED Then
{
var1 = 저점[2,1];
}
#하락구간의 마지막 고점 저장
if Color == BLUE Then
{
var2 = 고점[2,1];
}
if MarketPosition <= 0 Then
{
if color == BLUE and var1 > 0 and L > var1-PriceScale*50 Then
Buy("b",AtLimit,var1-PriceScale*50,1);
}
if MarketPosition == 1 Then
{
value1 = Floor(MaxEntries/2)+1;
Buy("bb",AtLimit,(var1[BarsSinceEntry]-PriceScale*50)-(PriceScale*50)*MaxEntries,value1);
if T == -1 and 고점[1,1] > 0 Then
ExitLong("bx1",AtLimit,고점[1,1]+PriceScale*1);
if T == 1 and 고점[2,1] > 0 Then
ExitLong("bx2",AtLimit,고점[2,1]+PriceScale*1);
}
if MarketPosition >= 0 Then
{
if Color == RED and Var2 > 0 and H < var2+PriceScale*50 Then
Sell("s",AtLimit,Var2+PriceScale*50,1);
}
if MarketPosition == -1 Then
{
value1 = Floor(MaxEntries/2)+1;
Sell("ss",AtLimit,(var2[BarsSinceEntry]+PriceScale*50)+(PriceScale*50)*MaxEntries,value1);
if T == 1 and 저점[1,1] > 0 Then
ExitShort("sx1",AtLimit,저점[1,1]-PriceScale*1);
if T == -1 and 저점[2,1] > 0 Then
ExitShort("sx2",AtLimit,저점[2,1]-PriceScale*1);
}
2022-01-13
770
글번호 155427
시스템
답변완료
문의드립니다
1)input : ntime1(5),P1(5),P2(20),P3(60);
var : S1(0),D1(0),TM(0),TF(0),cnt(0);
var : sum1(0),mav1(0),sum11(0),mav11(0);
var : sum2(0),mav2(0),sum21(0),mav21(0);
var : sum3(0),mav3(0),sum31(0),mav31(0);
Array : C1[100](0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%ntime1;
if Bdate != Bdate[1] or
(ntime1 != 1 and Bdate == Bdate[1] and TF < TF[1]) or
(ntime1 == 1 and Bdate == Bdate[1] and TM > TM[1]) Then
{
for cnt = 1 to 99
{
C1[cnt] = C1[cnt-1][1];
}
}
C1[0] = C;
if C1[P1] > 0 then
{
sum1 = 0;
sum11 = 0;
for cnt = 0 to P1-1
{
sum1 = sum1+C1[cnt];
sum11 = sum11+C1[cnt+1];
}
mav1 = sum1/P1;
mav11 = sum11/P1;
plot1(mav1,"이평1",IFf(mav1 > mav11,GREEN,GREEN));
}
if C1[P2] > 0 then
{
sum2 = 0;
sum21 = 0;
for cnt = 0 to P2-1
{
sum2 = sum1+C1[cnt];
sum21 = sum21+C1[cnt+1];
}
mav2 = sum2/P2;
mav21 = sum21/P2;
plot2(mav2,"이평2",IFf(mav2 > mav21,GREEN,GREEN));
}
if C1[P3] > 0 then
{
sum3 = 0;
sum31 = 0;
for cnt = 0 to P3-1
{
sum3 = sum3+C1[cnt];
sum31 = sum31+C1[cnt+1];
}
mav3 = sum3/P3;
mav31 = sum31/P3;
plot3(mav3,"이평3",IFf(mav3 > mav31,GREEN,GREEN));
}
}
2)INPUTS: LENGTH1(13);
VARS : DEMA1(0);
var1= EMA(C,LENGTH1);
value1= EMA(EMa(C,LENGTH1),LENGTH1);
DEMA1 = var1 * 2 - value1;
if C >DEMA1 Then
PLOT1(DEMA1, "DEMA1",GREEN);
Else
PLOT1(DEMA1, "DEMA1",GREEN);
1번과2번수식으로 5이평선이 60이평선을상승 크로스하면 오른쪽으로 일자수평선이 나오게(트리로)색은노랑색 색상크기조정하게끔,
반대로 5이평선이 60이평선을 하락크로스하면 오른쪽으로 일자수평선이 나오게 (트리로)색상은 레드색으로 색상크기조정하게,그리고 상승이나하락크로스하면 압전것은 사라지고일자수평선1개만유지하도록 1번과2번동일하게 2개 수정부탁드립니다~~미리감사드립니다
2022-01-13
941
글번호 155424
지표