예스스탁
예스스탁 답변
2024-09-09 14:04:44
안녕하세요
예스스탁입니다.
사용자함수 2개를 먼자 만드신 후 지표식 작성해서 적용하셔야 합니다.
지표영역에 막대로 표시되어야 해서 막대는 추세선으로 출럭합니다.
다만 추세선은 봉완성시에만 출력되므로 차트 마지막봉은 표시되지 않습니다.
지표사이의 채우기는 지표석성 차트표시탭에서 직접 설정하셔야 합니다.
1.
사용자함수명 : xrf
반환값형 : 숫자형
input : values(Numeric),length(Numeric);
var : r_val(Nan),i(0);
r_val = Nan;
if length >= 1 Then
{
for i = 0 to length step 1
{
if IsNaN(r_val) == true or IsNaN(values[i]) == False Then
{
r_val = values[i];
}
}
xrf = r_val;
}
2
사용함수명 : xsa
반환값형 : 숫자형
input : src(Numeric),len(Numeric),wei(Numeric);
var : sumf(0),mav(0),out(0);
sumf = 0.0;
mav = 0.0;
out = 0.0;
sumf = iff(isnan(sumf[1])==true,0,sumf[1]) - iff(IsNaN(src[len]) == true,0,src[len]) + src;
mav = iff(IsNaN(src[len]) == true,Nan,sumf/len);
out = iff(IsNan(out[1])==true, mav , (src*wei+out[1]*(len-wei))/len);
xsa = out;
3 지표
var : fundtrend(0),typ(0),lol(0),hoh(0),bullbearline(0),bankerentry(False),TL(0);
fundtrend = ((3*xsa((close- lowest(low,27))/(highest(high,27)-lowest(low,27))*100,5,1)-2*xsa(xsa((close-lowest(low,27))/(highest(high,27)-lowest(low,27))*100,5,1),3,1)-50)*1.032+50);
typ = (2*close+high+low+open)/5;
lol = lowest(low,34);
hoh = highest(high,34);
bullbearline = ema((typ-lol)/(hoh-lol)*100,13);
bankerentry = CrossUp(fundtrend,bullbearline) and bullbearline<25;
TL = TL_New_Self(sDate,sTime,fundtrend,sdate,sTime,bullbearline);
TL_SetSize(TL,1);
if fundtrend>bullbearline Then
TL_SetColor(TL,Green);
if fundtrend<(xrf(fundtrend*0.95,1)) Then
TL_SetColor(TL,White);
if fundtrend<bullbearline Then
TL_SetColor(TL,Red);
if fundtrend<bullbearline and fundtrend>(xrf(fundtrend*0.95,1)) Then
TL_SetColor(TL,Blue);
Plot1(80,"80",red);
Plot2(20,"20",yellow);
Plot3(10,"10",lime);
Plot4(90,"90",Magenta);
즐거운 하루되세요
> 부호장자 님이 쓴 글입니다.
> 제목 : 수식변환요청
> 수고하십니다.
아래 수식을 예스로 변환부탁드립니다.
===============================
study("[blackcat] L3 Banker Fund Flow Trend Oscillator", overlay=false)
//functions
xrf(values, length) =>
r_val = float(na)
if length >= 1
for i = 0 to length by 1
if na(r_val) or not na(values[i])
r_val := values[i]
r_val
r_val
xsa(src,len,wei) =>
sumf = 0.0
ma = 0.0
out = 0.0
sumf := nz(sumf[1]) - nz(src[len]) + src
ma := na(src[len]) ? na : sumf/len
out := na(out[1]) ? ma : (src*wei+out[1]*(len-wei))/len
out
//set up a simple model of banker fund flow trend
fundtrend = ((3*xsa((close- lowest(low,27))/(highest(high,27)-lowest(low,27))*100,5,1)-2*xsa(xsa((close-lowest(low,27))/(highest(high,27)-lowest(low,27))*100,5,1),3,1)-50)*1.032+50)
//define typical price for banker fund
typ = (2*close+high+low+open)/5
//lowest low with mid term fib # 34
lol = lowest(low,34)
//highest high with mid term fib # 34
hoh = highest(high,34)
//define banker fund flow bull bear line
bullbearline = ema((typ-lol)/(hoh-lol)*100,13)
//define banker entry signal
bankerentry = crossover(fundtrend,bullbearline) and bullbearline<25
//banker fund entry with yellow candle
plotcandle(0,50,0,50,color=bankerentry ? color.new(color.yellow,0):na)
//banker increase position with green candle
plotcandle(fundtrend,bullbearline,fundtrend,bullbearline,color=fundtrend>bullbearline ? color.new(color.green,0):na)
//banker decrease position with white candle
plotcandle(fundtrend,bullbearline,fundtrend,bullbearline,color=fundtrend<(xrf(fundtrend*0.95,1)) ? color.new(color.white,0):na)
//banker fund exit/quit with red candle
plotcandle(fundtrend,bullbearline,fundtrend,bullbearline,color=fundtrend<bullbearline ? color.new(color.red,0):na)
//banker fund Weak rebound with blue candle
plotcandle(fundtrend,bullbearline,fundtrend,bullbearline,color=fundtrend<bullbearline and fundtrend>(xrf(fundtrend*0.95,1)) ? color.new(color.blue,0):na)
//overbought and oversold threshold lines
h1 = hline(80,color=color.red, linestyle=hline.style_dotted)
h2 = hline(20, color=color.yellow, linestyle=hline.style_dotted)
h3 = hline(10,color=color.lime, linestyle=hline.style_dotted)
h4 = hline(90, color=color.fuchsia, linestyle=hline.style_dotted)
fill(h2,h3,color=color.yellow,transp=70)
fill(h1,h4,color=color.fuchsia,transp=70)
alertcondition(bankerentry, title='Alert on Yellow Candle', message='Yellow Candle!')
alertcondition(fundtrend>bullbearline, title='Alert on Green Candle', message='Green Candle!')
alertcondition(fundtrend<(xrf(fundtrend*0.95,1)), title='Alert on White Candle', message='White Candle!')
alertcondition(fundtrend<bullbearline, title='Alert on Red Candle', message='Red Candle!')
alertcondition(fundtrend<bullbearline and fundtrend>(xrf(fundtrend*0.95,1)), title='Alert on Blue Candle', message='Blue Candle!')