예스스탁
예스스탁 답변
2025-05-23 10:38:21
안녕하세요
예스스탁입니다.
input : shortlen(12);
input : longlen(26);
input : signallen(9);
input : 지수이평(1);#1:이면 지수이평 사용, 0이면 단순이평 사용
var : src(0),short(0),long(0),po(0),sl(0),hist(0);
src = close;
if 지수이평 == 1 Then
short = ema(src, shortlen);
Else
short = ma(src, shortlen);
if 지수이평 == 1 Then
long = ema(src, longlen);
Else
long = ma(src, longlen);
po = (short - long) / long * 100;
if 지수이평 == 1 Then
sl = ema(po, signallen);
Else
sl = ma(po, signallen);
hist = po - sl;
plot1(hist,"Histogram",IFf(hist >= 0 , IFf(hist[1] < hist , Green , LightGreen) , IFf(hist[1] < hist , Pink , Red)));
plot2(po, "PPO",teal);
plot3(sl, "Signal Line", Orange);
PlotBaseLine1(0, "Zero Line", Gray) ;
즐거운 하루되세요
> 삼손감자 님이 쓴 글입니다.
> 제목 : 지표 변환 부탁드립니다.
> //@version=6
indicator(title="Price Oscillator", shorttitle="PPO", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
shortlen = input.int(12, "Short Length", minval=1)
longlen = input.int(26, "Long Length", minval=1)
signallen = input.int(9, "Signal Length", minval=1)
src = input.source(close, title="Source")
exp = input.bool(true, "Use exponential MA")
esma(source, length)=>
s = ta.sma(source, length)
e = ta.ema(source, length)
exp ? e : s
short = esma(src, shortlen)
long = esma(src, longlen)
po = (short - long) / long * 100
sl = esma(po, signallen)
hist = po - sl
plot(hist, title = "Histogram", style = plot.style_columns, color = (hist >= 0 ? (hist[1] < hist ? #26A69A : #B2DFDB) : (hist[1] < hist ? #FFCDD2 : #FF5252)))
plot(po, color=color.teal, title="PPO")
plot(sl, color=color.orange, title="Signal Line")
hline(0, "Zero Line", color=#787B86)