예스스탁
예스스탁 답변
2023-01-02 11:36:13
안녕하세요
예스스탁입니다.
input : conv(50),length(20);
var : src(0);
var : maxv(0),minv(0),diff(0),psi(0);
src = close;
if Index == 0 Then
{
maxv = src;
minv = src;
}
Else
{
maxv = max(src, maxv - (maxv - src) / conv);
minv = min(src, minv + (src - minv) / conv);
}
diff = Log(maxv - minv);
psi = -50*CoefficientR(diff, Index, length)+50;
plot1(psi,"선");
PlotBaseLine1(80);
즐거운 하루되세요
> 나고수야 님이 쓴 글입니다.
> 제목 : 지표변환부탁드립니다
>
indicator("Squeeze Index [LuxAlgo]", "Squeeze Index [LuxAlgo]")
//------------------------------------------------------------------------------
//Settings
//-----------------------------------------------------------------------------{
conv = input(50, 'Convergence Factor')
length = input(20)
src = input(close)
//Style
col_0 = input(#ffeb3b, 'Gradient'
, inline = 'inline0'
, group = 'Style')
col_1 = input(#ff5d00, ''
, inline = 'inline0'
, group = 'Style')
col_2 = input(#ff1100, ''
, inline = 'inline0'
, group = 'Style')
//-----------------------------------------------------------------------------}
//Squeeze index
//-----------------------------------------------------------------------------{
var max = 0.
var min = 0.
max := nz(math.max(src, max - (max - src) / conv), src)
min := nz(math.min(src, min + (src - min) / conv), src)
diff = math.log(max - min)
psi = -50 * ta.correlation(diff, bar_index, length) + 50
//-----------------------------------------------------------------------------}
//Plots
//-----------------------------------------------------------------------------{
css1 = color.from_gradient(psi, 0, 80, col_0, col_1)
css2 = color.from_gradient(psi, 80, 100, css1, col_2)
plot_0 = plot(psi, 'PSI', psi > 80 ? na : css2)
plot(psi, 'Dots', psi > 80 ? css2 : na, style = plot.style_cross)
plot_1 = plot(80, display = display.none, editable = false)
fill(plot_0, plot_1, psi < 80 ? na : color.new(#ff1100, 80))
hline(80)
//-----------------------------------------------------------------------------}