커뮤니티
추세선 봉 갯수
하락전환하면 나오는 매도신호를,
하락전환후, 하락추세 박스 내에서 7번째 봉이 생기면 매수, 다음봉에 매수청산.
상승은 반대. 감사합니다.
input : Period(1);
Var:box(0),j(0),T(0),date11(0),date12(0),time11(0),time12(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
{
HiBar[j] = HiBar[j] + 1;
LoBar[j] = LoBar[j] + 1;
}
if crossup(c,highest(H,Period)[1]) Then
T = 1;
if CrossDown(c,Lowest(L,Period)[1]) Then
T = -1;
If T == -1 Then
{
If T[1] != -1 Then
{
{
LoVal[j+1] = LoVal[j];
LoBar[j+1] = LoBar[j];
}
LoVal[0] = L;
LoBar[0] = 0;
date11 = date[HiBar[0]];
time11 = stime[HiBar[0]];
Value11 = HiVal[0];
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
box = Box_New(date11,time11,Value11,date12,time12,Value12);
Box_SetColor(box,Lime);
Box_SetFill(box,true,70);
Sell();
}
If LoVal[0] >= L Then
{
LoVal[0] = L;
LoBar[0] = 0;
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
Box_SetEnd(box,date12,time12,Value12);
}
}
If T == 1 Then
{
If T[1] != 1 Then
{
{
HiVal[j+1] = HiVal[j];
HiBar[j+1] = HiBar[j];
}
HiVal[0] = H;
HiBar[0] = 0;
date11 = date[LoBar[0]];
time11 = stime[LoBar[0]];
Value11 = LoVal[0];
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
box = Box_New(date11,time11,Value11,date12,time12,Value12);
Box_SetColor(box,Magenta);
Box_SetFill(box,true,40);
Buy();
}
If HiVal[0] <= H Then
{
HiVal[0] = H;
HiBar[0] = 0;
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
Box_SetEnd(box,date12,time12,Value12);
}
}
if MarketPosition == 1 and BarsSinceEntry == 1 Then ExitLong();
if MarketPosition == -1 and BarsSinceEntry == 1 Then ExitShort();
답변 1
예스스탁 예스스탁 답변
2026-03-16 10:43:27