예스스탁
예스스탁 답변
2023-06-20 14:21:48
안녕하세요
예스스탁입니다.
input : alpha(0.2);
var : src(0),gamma(0),L0(0),L1(0),L2(0),L3(0),cu(0),cd(0);
var : temp(0),LaRSI(0),Color(0);
src = close;
gamma = 1 - alpha;
L0 = 0.0;
L0 = (1 - gamma) * src + gamma * iff(IsNaN(L0[1])==False,L0[1],0);
L1 = 0.0;
L1 = -gamma * L0 + iff(IsNaN(L0[1])==False,L0[1],0) + gamma * iff(IsNaN(L1[1])==False,L1[1],0);
L2 = 0.0;
L2 = -gamma * L1 + iff(IsNaN(L1[1])==False,L1[1],0) + gamma * iff(IsNaN(L2[1])==False,L2[1],0);
L3 = 0.0;
L3 = -gamma * L2 + iff(IsNaN(L2[1])==False,L2[1],0)+ gamma * iff(IsNaN(L3[1])==False,L3[1],0);
cu = IFf(L0 > L1 , L0 - L1 , 0) + IFf(L1 > L2 , L1 - L2 , 0) + IFf(L2 > L3 , L2 - L3 , 0);
cd = IFf(L0 < L1 , L1 - L0 , 0) + IFf(L1 < L2 , L2 - L1 , 0) + IFf(L2 < L3 , L3 - L2 , 0);
temp = iff(cu + cd == 0 , -1 , cu + cd);
LaRSI = iff(temp == -1 , 0 , cu / temp);
Color = iff(LaRSI > LaRSI[1] , green , red);
plot1(100 * LaRSI, "LaRSI", color);
plot2(20,"20",maroon);
plot3(80,"80",maroon);
즐거운 하루되세요
> 매치다2 님이 쓴 글입니다.
> 제목 : 잘 부탁드립니다
> 예스로 부탁드립니다
//@version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Developer: John EHLERS
// © KivancOzbilgic
// Author:Kıvanç Özbilgiç
study("Laguerre RSI", shorttitle="LaRSI", overlay=false)
src = input(title="Source", defval=close)
alpha = input(title="Alpha", type=input.float, minval=0, maxval=1, step=0.1, defval=0.2)
colorchange = input(title="Change Color ?", type=input.bool, defval=false)
gamma = 1 - alpha
L0 = 0.0
L0 := (1 - gamma) * src + gamma * nz(L0[1])
L1 = 0.0
L1 := -gamma * L0 + nz(L0[1]) + gamma * nz(L1[1])
L2 = 0.0
L2 := -gamma * L1 + nz(L1[1]) + gamma * nz(L2[1])
L3 = 0.0
L3 := -gamma * L2 + nz(L2[1]) + gamma * nz(L3[1])
cu = (L0 > L1 ? L0 - L1 : 0) + (L1 > L2 ? L1 - L2 : 0) + (L2 > L3 ? L2 - L3 : 0)
cd = (L0 < L1 ? L1 - L0 : 0) + (L1 < L2 ? L2 - L1 : 0) + (L2 < L3 ? L3 - L2 : 0)
temp = cu + cd == 0 ? -1 : cu + cd
LaRSI = temp == -1 ? 0 : cu / temp
Color = colorchange ? LaRSI > LaRSI[1] ? color.green : color.red : color.blue
plot(100 * LaRSI, title="LaRSI", linewidth=2, color=Color, transp=0)
plot(20, linewidth=1, color=color.maroon, transp=0)
plot(80, linewidth=1, color=color.maroon, transp=0)
alertcondition(crossover(100 * LaRSI, 20), title="LaRSI Crossover Alarm", message="Laguerre RSI crosses OVER 20 - BUY SIGNAL!")
alertcondition(crossunder(100 * LaRSI, 80), title="Price Crossunder Alarm", message="Laguerre RSI crosses UNDER 80 - SELL SIGNAL!")