예스스탁
예스스탁 답변
2025-03-20 19:09:50
안녕하세요
예스스탁입니다.
점선으로 출력되는 선을 실선으로 변경했습니다.
참고로 수식에서 TL_SetStyle함수가 선종류, TL_SetSize가 굵기 설정하는 함수입니다.
해당선들이 매봉 모두 지우고
현재시점에서 과거봉에 그리는 내용이고
검색은 과거봉에서 현재봉에 오면서 출력하고
현재시점에서 과거로 가면서 출력하지는 못합니다.
각 점은 각봉이 최종봉일때 그려진 값과 비교하고
돌파여부를 판단해 출력되게 됩니다.
이용에 참고하시기 바랍니다.
input : lookback(72);
input : multiplier(1);
input : high_col(red);
input : low_col(lime);
var : hest(0),lest(0);
var : alpha(0),source(0),ATRV(0),A(0);
var : high_i(Nan),high_D(Nan),high_T(Nan),high_V(Nan);
VAR : low_i(Nan),low_D(Nan),low_T(Nan),low_V(Nan);
hest = highest(H,lookback);
lest = lowest(L,lookback);
alpha = 1 / 200 ;
source = TrueRange;
ATrV = IFf(IsNan(ATrV[1]) == true, ma(source,200) , alpha * source + (1 - alpha) * IFf(isnan(ATrV[1])==true,0,ATrV[1]));
A = ATRV*multiplier;
if high[1] == hest[1] and high < hest Then
{
high_i = Index-1;
high_d = sDate[1];
high_t = sTime[1];
high_v = high[1];
}
if low[1] == lest[1] and low > lest Then
{
low_i = Index-1;
low_v = low[1];
}
var : size(0),mid(0),mid_index(0),i(0),idx(0);
var : hTL1(0),hTL2(0),hTX(0);
var : lTL1(0),lTL2(0),lTX(0);
var : mTL(0),mTX(0);
size = index - IFf(high_i > low_i , low_i , high_i);
TL_Delete(hTL1);
TL_Delete(hTL2);
Text_Delete(hTX);
hTL1 = TL_New(sDate[Index-high_i],sTime[Index-high_i],high_v,NextBarSdate,NextBarStime,high_v);
TL_SetColor(hTL1,high_col);
TL_SetSize(hTL1,2);
TL_SetStyle(hTL1,0);
hTL2 = TL_New(sDate[(Index-high_i)-3],sTime[(Index-high_i)-3],high_v-A,NextBarSdate,NextBarStime,high_v-A);
TL_SetColor(hTL2,high_col);
TL_SetSize(hTL2,0);
TL_SetStyle(hTL2,0);
hTX = Text_New(NextBarSdate,NextBarStime,high_v,ntostr(high_v,2));
Text_SetColor(hTX,high_col);
Text_SetStyle(hTX,0,2);
TL_Delete(lTL1);
TL_Delete(lTL2);
Text_Delete(lTX);
lTL1 = TL_New(sDate[Index-Low_i],sTime[Index-Low_i],Low_v,NextBarSdate,NextBarStime,Low_v);
TL_SetColor(lTL1,Low_col);
TL_SetSize(lTL1,2);
TL_SetStyle(lTL1,0);
lTL2 = TL_New(sDate[(Index-low_i)-3],sTime[(Index-low_i)-3],low_v+A,NextBarSdate,NextBarStime,low_v+A);
TL_SetColor(lTL2,Low_col);
TL_SetSize(lTL2,0);
TL_SetStyle(lTL2,0);
lTX = Text_New(NextBarSdate,NextBarStime,low_v,ntostr(low_v,2));
Text_SetColor(lTX,low_col);
Text_SetStyle(lTX,0,2);
mid = avg(high_v, low_v);
mid_index = size/2;
TL_Delete(mTL);
Text_Delete(mTX);
mTL = TL_New(sDate[mid_index],sTime[mid_index],mid,NextBarSdate,NextBarStime,mid);
TL_SetColor(mTL,Black);
TL_SetSize(mTL,0);
TL_SetStyle(mTL,3);
mTX = Text_New(NextBarSdate,NextBarStime,mid,ntostr(mid,2));
Text_SetColor(mTX,Black);
Text_SetStyle(mTX,0,2);
if CrossUp(C,high_v-A) Then
Plot1(H,"검색",Magenta);
if CrossDown(C,low_v+A) Then
Plot2(L,"검색",Cyan);
즐거운 하루되세요
> 이루 님이 쓴 글입니다.
> 제목 : 수식 요청합니다
> 아래 그림과 수식은 예스스탁에서 변환해준 식입니다. 점선부분 2부분을 실선으로 plot하도록 부탁드립니다.
아울러
검색에서 두 부분을 돌파하는 조건을 만들려고 합니다.
input : lookback(72);
input : multiplier(1);
input : high_col(red);
input : low_col(lime);
var : hest(0),lest(0);
var : alpha(0),source(0),ATRV(0),A(0);
var : high_i(Nan),high_D(Nan),high_T(Nan),high_V(Nan);
VAR : low_i(Nan),low_D(Nan),low_T(Nan),low_V(Nan);
hest = highest(H,lookback);
lest = lowest(L,lookback);
alpha = 1 / 200 ;
source = TrueRange;
ATrV = IFf(IsNan(ATrV[1]) == true, ma(source,200) , alpha * source + (1 - alpha) * IFf(isnan(ATrV[1])==true,0,ATrV[1]));
A = ATRV*multiplier;
if high[1] == hest[1] and high < hest Then
{
high_i = Index-1;
high_d = sDate[1];
high_t = sTime[1];
high_v = high[1];
}
if low[1] == lest[1] and low > lest Then
{
low_i = Index-1;
low_v = low[1];
}
var : size(0),mid(0),mid_index(0),i(0),idx(0);
var : hTL1(0),hTL2(0),hTX(0);
var : lTL1(0),lTL2(0),lTX(0);
var : mTL(0),mTX(0);
size = index - IFf(high_i > low_i , low_i , high_i);
TL_Delete(hTL1);
TL_Delete(hTL2);
Text_Delete(hTX);
hTL1 = TL_New(sDate[Index-high_i],sTime[Index-high_i],high_v,NextBarSdate,NextBarStime,high_v);
TL_SetColor(hTL1,high_col);
TL_SetSize(hTL1,2);
hTL2 = TL_New(sDate[(Index-high_i)-3],sTime[(Index-high_i)-3],high_v-A,NextBarSdate,NextBarStime,high_v-A);
TL_SetColor(hTL2,high_col);
TL_SetSize(hTL2,0);
TL_SetStyle(hTL2,3);
hTX = Text_New(NextBarSdate,NextBarStime,high_v,ntostr(high_v,2));
Text_SetColor(hTX,high_col);
Text_SetStyle(hTX,0,2);
TL_Delete(lTL1);
TL_Delete(lTL2);
Text_Delete(lTX);
lTL1 = TL_New(sDate[Index-Low_i],sTime[Index-Low_i],Low_v,NextBarSdate,NextBarStime,Low_v);
TL_SetColor(lTL1,Low_col);
TL_SetSize(lTL1,2);
lTL2 = TL_New(sDate[(Index-low_i)-3],sTime[(Index-low_i)-3],low_v+A,NextBarSdate,NextBarStime,low_v+A);
TL_SetColor(lTL2,Low_col);
TL_SetSize(lTL2,0);
TL_SetStyle(lTL2,3);
lTX = Text_New(NextBarSdate,NextBarStime,low_v,ntostr(low_v,2));
Text_SetColor(lTX,low_col);
Text_SetStyle(lTX,0,2);
mid = avg(high_v, low_v);
mid_index = size/2;
TL_Delete(mTL);
Text_Delete(mTX);
mTL = TL_New(sDate[mid_index],sTime[mid_index],mid,NextBarSdate,NextBarStime,mid);
TL_SetColor(mTL,Black);
TL_SetSize(mTL,0);
TL_SetStyle(mTL,3);
mTX = Text_New(NextBarSdate,NextBarStime,mid,ntostr(mid,2));
Text_SetColor(mTX,Black);
Text_SetStyle(mTX,0,2);