답변완료
타주기 전환, 도지
1번 수식. (꼬리 삭제)
input : N(15);
var : S1(0),D1(0),TF(0),box(0),idx(0);
var : oo(0),hh(0),ll(0),TL1(0),TL2(0),clr(0),ii(0),TL(0);
Plot1(c);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
idx = 0;
}
Else
idx = idx+1;
if D1 > 0 then
{
TF = idx%N;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and TF < TF[1]) Then
{
oo = O;
hh = H;
ll = L;
box = Box_New(sDate,sTime,oo,NextBarSdate,NextBarStime,c);
ii = 1;
}
Else
{
ii = ii +1;
if h > hh Then
hh = h;
if l < ll Then
ll = l;
var1 = Round(ii/2,1);
Box_SetEnd(box,sDate,sTime,C);
}
if C > oo Then
clr = Red;
else if C < oo Then
clr = Blue;
Else
clr = Green;
Box_SetColor(box,clr);
Box_SetSize(box,1);
Box_SetFill(box,true,255);
}
타주기 박스가 상승 전환시(음봉 박스 후 첫 양봉 박스), 상승 박스 하단에 네모 표시.
계속 상승하다 하락 전환시, 하단(상승) 네모 지우고, 첫 하락 박스 상단에 네모 표시.
도지는 무시.
2번수식.(꼬리 포함)
input : N(15);
var : S1(0),D1(0),TF(0),box(0),idx(0);
var : oo(0),hh(0),ll(0),TL1(0),TL2(0),clr(0),ii(0),TL(0);
Plot1(c);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
idx = 0;
}
Else
idx = idx+1;
if D1 > 0 then
{
TF = idx%N;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and TF < TF[1]) Then
{
value1 = sDate;
value2 = sTime;
oo = O;
hh = H;
ll = L;
box = Box_New(value1,Value2,hh,NextBarSdate,NextBarStime,ll);
ii = 1;
}
Else
{
ii = ii +1;
if h > hh Then
hh = h;
if l < ll Then
ll = l;
var1 = Round(ii/2,1);
Box_SetBegin(box,value1,Value2,HH);
Box_SetEnd(box,sDate,sTime,LL);
}
if C > oo Then
clr = Red;
else if C < oo Then
clr = Blue;
Else
clr = Gold;
Box_SetColor(box,clr);
Box_SetSize(box,1);
Box_SetFill(box,true,255);
}
도지 박스 색상을 한가지(gold) 색에서, 직전 박스와 동일하게 해서 두가지 색으로 변경.
바로 직전 박스 색이 blue면 blue 색으로, red면 red 색으로 각각 변경.
상승중 도지는 red, 하락중 도지는 blue. 감사합니다.
2023-05-07
917
글번호 168735
지표
답변완료
문의 드립니다.
//@version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KivancOzbilgic
//created by: @Anil_Ozeksi
//developer: ANIL ÖZEKŞİ
//author: @kivancozbilgic
var : src(0);
src = close;
input : length(6),percent(5.1);
input : mav(5);//"1:SMA", "2:EMA", "3:WMA", "4:TMA", "5:VAR", "6:WWMA", "7:ZLEMA", "8:TSF"]);
var : valpha(0),vud1(0),vdd1(0),vUD(0),vdd(0),vCMO(0),varv(0);
var : wwalpha(0),WWMA(0);
var : zxLag(0),zxEMAData(0),ZLEMA(0);
var : lrc(0),LRs(0),TSF(0),MAvg(0);
valpha=2/(length+1);
vud1=iff(src>src[1] , src-src[1] , 0);
vdd1=iff(src<src[1] , src[1]-src , 0);
vUD=AccumN(vud1,9);
vDD=AccumN(vdd1,9);
vCMO= iff(isnan((vUD-vDD)/(vUD+vDD)) == true,0,(vUD-vDD)/(vUD+vDD));
varv =0.0;
varv = iff(isnan(valpha*abs(vCMO)*src) ==true,0,valpha*abs(vCMO)*src)+(1-valpha*abs(vCMO))*iff(isnan(varv[1])==true,0,varv[1]);
wwalpha = 1/ length;
WWMA = 0.0;
WWMA = wwalpha*src + (1-wwalpha)*iff(isnan(WWMA[1])==true,0,WWMA[1]);
zxLag = iff(length/2==round(length/2,0) , length/2 , (length - 1) / 2);
zxEMAData = (src + (src - src[zxLag]));
ZLEMA = ema(zxEMAData, length);
TSF = LRL(src, length)+LRS(src, length);
if mav== 1 Then #SMA
{
MAvg = ma(src,Length) ;
}
if mav== 2 Then #Ema
{
Mavg = ema(src, Length);
}
if mav== 3 Then #Ema
{
Mavg = wma(src, Length);
}
if mav== 4 Then #Tma
{
Mavg = ma(ma(src, Ceiling(length / 2)), floor(length / 2) + 1);
}
if mav== 5 Then #VAR
{
Mavg = varv;
}
if mav== 6 Then #WWMA
{
Mavg = WWMA;
}
if mav== 7 Then #ZLEMA
{
Mavg = ZLEMA;
}
if mav== 8 Then #TSF
{
Mavg = TSF;
}
var : fark(0),longStop(0),longStopPrev(0),shortStop(0),shortStopPrev(0);
var : dir(0),MT(0),OTT(0),OTTC(0);
fark=MAvg*percent*0.01;
longStop = MAvg - fark;
longStopPrev = iff(isnan(longStop[1]) == true, longStop,longStop[1]);
longStop = iff(MAvg > longStopPrev , max(longStop, longStopPrev) , longStop);
shortStop = MAvg + fark;
shortStopPrev = iff(isnan(shortStop[1]) == true, shortStop,shortStop[1]);
shortStop = iff(MAvg < shortStopPrev , min(shortStop, shortStopPrev) , shortStop);
dir = 1;
dir = iff(isnan(dir[1])==true,dir,dir[1]);
dir = iff(dir == -1 and MAvg > shortStopPrev , 1 , IFf(dir == 1 and MAvg < longStopPrev , -1 , dir));
MT = iff(dir==1 , longStop , shortStop);
OTT= iff(MAvg>MT , MT*(200+percent)/200 , MT*(200-percent)/200 );
OTTC = IFf(OTT[2] > OTT[3] , green ,red);
plot1(MAvg,"Support Line",Blue);
plot2(IFf(isnan(OTT[2]) == true,0,OTT[1]), "OTT",OTTC);
위 수식에서 두 선이 교차하면 매수/매도 신호가 나오게 해주세요.
2023-05-05
959
글번호 168734
시스템
답변완료
피봇 수식변경
늘 감사합니다.
아래의 수식을 data2용으로 변경해 주세요
input : ntime(83000);
Var : PP(0), R1(0),R2(0),R3(0),S1(0),S2(0),S3(0);
var : DH(0),DL(0),DC(0);
var : DH1(0),DL1(0),DC1(0);
if (sdate != sDate[1] and sTime >= ntime) or
(sDate == sDate[1] and sTime >= ntime and sTime[1] < ntime) Then
{
DH = H;
DL = L;
DH1 = DH[1];
DL1 = DL[1];
DC1 = DC[1];
}
if DH > 0 and H > DH Then
DH = H;
if DL > 0 and L < DL Then
DL = L;
DC = C;
if DH1 > 0 and DL1 > 0 Then
{
PP = (DH1 + DC1 + DL1 )/3; //피봇선
R1 = 2 * PP - DL1; //1차저항
R2 = PP+DH1-DL1; //2차저항
R3 = DH1 + 2*(PP - DL1); //3차저항
S1 = 2 * PP - DH1; //1차지지
S2 = PP-DH1+DL1; //2차지지
S3 = DL1 - 2*(DH1 - PP); //3차지지
plot1(PP,"피봇선");
plot2(R1,"1차저항");
plot3(R2,"2차저항");
plot4(R3,"3차저항");
plot5(S1,"1차지지");
plot6(S2,"2차지지");
plot7(S3,"3차지지");
}
감사합니다.
2023-05-04
1192
글번호 168733
지표
답변완료
지표수식 변환 요청드립니다
수고하십니다.
아래지표식에서 타주기분지표가 종가완성봉기준으로 출력되도록 부탁드립니다.
그림참조
그림위=현 아래수식이용 예스챠트 출력화면(지표가 출렁거림),
그림아래=트레이딩뷰 동일지표 출력화면
//==============
input : 분(5),useClose1(true),length(1),mult(1);
var : ATrv(0),longStop(0),longStopprev(0),shortStop(0),shortStopPrev(0);
var : dir(1),dir1(0) ;
var : truehighv(0),TrueLowv(0),hsatr(0) ;
var : xClose(0),xOpen(0),xHigh(0),xLow(0);
var : xClose1(0),xOpen1(0),xHigh1(0),xLow1(0);
var : S1(0),D1(0),TM(0),TF(0),cnt(0),ii(0);
var : sum(0),longStop1(0),shortStop1(0),hv(0),lv(0);
var : longcolor(Crimson),shortcolor(Blue),tx(0);
Array : TrueRangev[100](0),AccumValue[100](0);
Array : oo[100](0),hh[100](0),ll[100](0),cc[100](0),hsc[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%분;
///30분
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 분 > 1 and TM >= TM[1]+분) or
(Bdate == Bdate[1] and 분 == 1 and TM > TM[1]) Then
{
ii = ii +1;
For cnt = 99 DownTo 1
{
TrueRangev[cnt] = TrueRangev[cnt-1];
oo[cnt] = oo[cnt-1];
hh[cnt] = hh[cnt-1];
ll[cnt] = ll[cnt-1];
cc[cnt] = cc[cnt-1];
hsc[cnt] = hsc[cnt-1];
AccumValue[cnt] = AccumValue[cnt-1];
}
AccumValue[0] = AccumValue[0]+1;
oo[0] = o;
hh[0] = h;
ll[0] = l;
Xopen1 = xopen[1];
Xhigh1 = xhigh[1];
Xlow1 = xlow[1];
Xclose1 = xclose[1];
longStop1 = longStop[1];
ShortStop1 = shortStop[1];
dir1 = dir[1];
}
if hh[0] > 0 and h > hh[0] Then
hh[0] = h;
if ll[0] > 0 and l < ll[0] Then
ll[0] = l;
cc[0] = c;
if ii == 1 then
{
xOpen = oo[0];
xClose = (oo[0]+hh[0]+ll[0]+cc[0])/4;
xHigh = MaxList(hh[0], xOpen, xClose);
xLow = MinList(ll[0], xOpen,xClose);
}
else
{
xClose = (oo[0]+hh[0]+ll[0]+cc[0])/4;
xOpen = (xOpen1 + xClose1)/2 ;
xHigh = MaxList(hh[0], xOpen, xClose) ;
xLow = MinList(ll[0], xOpen, xClose) ;
}
hsc[0] = xclose ;
if ii > 1 Then
{
If xClose1 > xHigh then
TrueHighv = xClose1;
else
TrueHighv = xHigh;
If xClose1 < xLow then
TrueLowv = xClose1;
else
TrueLowv = xLow;
TrueRangev[0] = TrueHighv - TrueLowv;
}
if ii > 2 Then
{
if TrueRangev[length-1] > 0 Then
{
sum = 0;
For cnt = 0 to length-1
{
sum = sum + TrueRangev[cnt];
}
hsatr = sum/length;
}
atrv = mult * hsatr;
hv = 0;
lv = 0;
For cnt = 0 to length-1
{
if useClose1 == true Then
{
if hv == 0 or (hv > 0 and hsc[cnt] > hv) Then
hv = hsc[cnt];
if lv == 0 or (lv > 0 and hsc[cnt] < lv) Then
lv = hsc[cnt];
}
Else
{
if hv == 0 or (hv > 0 and hh[cnt] > hv) Then
hv = hh[cnt];
if lv == 0 or (lv > 0 and ll[cnt] < lv) Then
lv = ll[cnt];
}
}
longStop = hv - atrv;
longStopPrev = longStop1;
longStop = iff(hsc[1] > longStopPrev , max(longStop, longStopPrev) , longStop);
shortStop = lv + atrv;
shortStopPrev = shortStop1;
shortStop = iff(hsc[1] < shortStopPrev , min(shortStop, shortStopPrev) , shortStop);
dir = iff(hsc[0] > shortStopPrev , 1 ,iff(hsc[0] < longStopPrev , -1 , dir1));
}
}
IF dir == 1 Then
{
plot1(longStop,"Long Stop",longColor);
NoPlot(2);
}
Else
{
NoPlot(1);
plot2(shortStop,"Short Stop",shortColor);
}
//======================
2023-05-04
2010
글번호 168718
지표