답변완료
추세선 박스 크기
input : Period(10);
Var:상승색(Red), 하락색(Blue);
Var:j(0),T(0);
Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0),
date21(0),date22(0),time21(0),time22(0),
date31(0),date32(0),time31(0),time32(0),tx(0),tx1(0),tl4(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
Array:r[7](0),fr[7](0),TL2[7](0),TL3[7](0),TX2[7](0),TX3[7](0);
var : box(0),box1(0);
Plot1(0);
r[0] = 0;
r[1] = 2;
r[2] = 3.;
r[3] = -1;
r[4] = -2.;
r[5] = 1;
r[6] = 0.5;
For j = 0 To 19
{
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
{
For j = 18 DownTo 0
{
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];
date21 = date[HiBar[0]];
time21 = stime[HiBar[0]];
date22 = date[0];
time22 = stime[0];
for j = 0 to 6
{
fr[j] = LoVal[1] + ((HiVal[0] - LoVal[1]) * r[j]);
}
box = box_new(date11,time11,Value11,date12,time12,Value12);
Box_SetColor(box,Lime);
Box_SetFill(box,true,35);
}
If LoVal[0] > L Then
{
LoVal[0] = L;
LoBar[0] = 0;
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
date22 = date[0];
time22 = stime[0];
Box_SetEnd(box,date12,time12,Value12);
}
}
If T == 1 Then
{
If T[1] != 1 Then
{
For j = 18 DownTo 0
{
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];
date31 = date[LoBar[0]];
time31 = stime[LoBar[0]];
date32 = date[0];
time32 = stime[0];
for j = 0 to 5
{
fr[j] = LoVal[0] + ((HiVal[1] - LoVal[0]) * r[j]);
}
box = Box_New(date11,time11,Value11,date12,time12,Value12);
Box_SetColor(box,Magenta);
Box_SetFill(box,true,35);
}
If HiVal[0] < H Then
{
HiVal[0] = H;
HiBar[0] = 0;
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date32 = date[0];
time32 = stime[0];
Box_SetEnd(box,date12,time12,Value12);
}
}
1.추세선이 전환되면 그 시점의 박스 크기를 시작점에 큰 글씨로 표기.
계속 커지면 계속 수정 변경하면서 추세가 끝날 때까지 크기를 표기.
2.추세가 역으로 전환되면 색상과 글자 크기를 작게 변경하여, 1p 이하는 지우고 1p 이상만 표기하여 저장.
감사합니다.
2022-11-16
950
글번호 163866
지표
답변완료
지표수식 부탁드립니다.
5분봉에서 15분 200일 지수이평 지표를 그리고 싶습니다.
밑에것으로 했는데 값이 다르네요
input : Atime(5),Period1(5),Period2(20),Period3(60);
Var : Ep1(0), JISU1(0), PreJISU1(0);
Var : Ep2(0), JISU2(0), PreJISU2(0);
Var : Ep3(0), JISU3(0), PreJISU3(0);
var : TF(0);
Ep1 = 2/(Period1+1);
Ep2 = 2/(Period2+1);
Ep3 = 2/(Period3+1);
TF = TimeToMinutes(stime)%Atime;
if Bdate != bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then{
value1 = value1+1;
PreJISU1 = JISU1[1];
PreJISU2 = JISU2[1];
PreJISU3 = JISU3[1];
}
if value1 <= 1 then {
JISU1 = C;
JISU2 = C;
JISU3 = C;
}
else{
JISU1 = C * EP1 + PreJISU1 * (1-EP1);
JISU2 = C * EP2 + PreJISU2 * (1-EP2);
JISU3 = C * EP3 + PreJISU3 * (1-EP3);
}
plot1(JiSu1);
plot2(Jisu2);
plot3(Jisu3);
2022-11-16
883
글번호 163863
지표
답변완료
수정부탁드립니다
예스스탁 언어로 변경 부탁드립니다
//@version=3
strategy(title = "Chop Zone Strategy - Buy Only")
colorTurquoise = #34dddd
colorDarkGreen = #006400
colorPaleGreen = #98fb98
colorLime = lime
colorDarkRed = #8B0000
colorRed = red
colorOrange = orange
colorLightOrange = #ffc04c
colorYellow = yellow
source = close
avg = hlc3
pi = atan(1) * 4
periods = 30
highestHigh = highest(periods)
lowestLow = lowest(periods)
range = 25 / (highestHigh - lowestLow) * lowestLow
ema34 = ema(source, 34)
x1_ema34 = 0
x2_ema34 = 1
y1_ema34 = 0
y2_ema34 = (ema34[1] - ema34) / avg * range
c_ema34 = sqrt((x2_ema34 - x1_ema34)*(x2_ema34 - x1_ema34) + (y2_ema34 - y1_ema34)*(y2_ema34 - y1_ema34))
emaAngle_1 = round(180 * acos((x2_ema34 - x1_ema34)/c_ema34) / pi)
emaAngle = iff(y2_ema34 > 0, - emaAngle_1, emaAngle_1)
chopZoneColor = emaAngle >= 5 ? colorTurquoise : emaAngle < 5 and emaAngle >= 3.57 ? colorDarkGreen : emaAngle < 3.57 and emaAngle >= 2.14 ? colorPaleGreen : emaAngle < 2.14 and emaAngle >= .71 ? colorLime : emaAngle <= -1 * 5 ? colorDarkRed : emaAngle > -1 * 5 and emaAngle <= -1 * 3.57 ? colorRed : emaAngle > -1 * 3.57 and emaAngle <= -1 * 2.14 ? colorOrange : emaAngle > -1 * 2.14 and emaAngle <= -1 * .71 ? colorLightOrange : colorYellow
plot(1, color=chopZoneColor, style=columns)
sensitivity = input(title="Sensitivity", type=integer, defval=3, minval=1, maxval=100)
boolclose = (chopZoneColor!=colorTurquoise)
boolbuy = (chopZoneColor==colorTurquoise and chopZoneColor[sensitivity]!=colorTurquoise)
for i = 1 to sensitivity-1
if (chopZoneColor[i]==colorTurquoise)
boolclose := false
if (chopZoneColor[i]!=colorTurquoise)
boolbuy := false
strategy.entry("buy", strategy.long, when=boolbuy)
strategy.close("buy", when = boolclose)
2022-11-16
1143
글번호 163861
시스템