예스스탁
예스스탁 답변
2024-06-25 11:40:38
안녕하세요
예스스탁입니다.
input : per(8);
input : smthit(false);
input : type(0); #1: SMA, 2: EMA, 3: WMA, 4: RMA
input : smthper(5);
input : colorbars(false);
input : showsignals(false);
var : mav(0),atrv(0),out(0),variant(0),alpha(0),rma(0),colorout(0),tx(0);
mav = ma(close - close[per], per);
atrv = atr(per);
out = mav/atrv * 50 + 50;
if type == 1 Then
variant = ma(out, smthper) ;
else if type == 2 Then
variant = ema(out, smthper);
else if type == 3 Then
variant = wma(out, smthper) ;
else if type == 4 Then
{
alpha = 1/smthper;
rma = IFf(IsNaN(rma[1]) == true, ma(out, smthper) , alpha * out + (1 - alpha) *IFf(IsNan(rma[1])==true,0,rma[1]));
variant = rma;
}
out = iff(smthit ,variant , out);
colorout = iff(out > 50 , green , red);
plot1(out,"out",colorout);
plot2(50,"50",gray);
if CrossUp(out,50) Then
{
tx = Text_New(sDate,sTime,L,"▲");
Text_SetColor(tx,Green);
Text_SetStyle(tx,2,0);
}
if CrossDown(out,50) Then
{
tx = Text_New(sDate,sTime,H,"▼");
Text_SetColor(tx,Red);
Text_SetStyle(tx,2,1);
}
즐거운 하루되세요
> alltoone 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 아래는 트레이딩 뷰 지표인데요,
지표 전환 가능하실까요?
답변 항상 감사드립니다.
//@version=5
indicator("Larry Williams Large Trade Index (LWTI) [Loxx]",
shorttitle="LWTI [Loxx]",
overlay = false,
timeframe="",
timeframe_gaps = true)
greencolor = #2DD204
redcolor = #D2042D
variant(type, src, len) =>
sig = 0.0
if type == "SMA"
sig := ta.sma(src, len)
else if type == "EMA"
sig := ta.ema(src, len)
else if type == "WMA"
sig := ta.wma(src, len)
else if type == "RMA"
sig := ta.rma(src, len)
sig
per = input.int(8, "Period", group = "Basic Settings")
smthit = input.bool(false, "Smooth LWPI?", group = "Basic Settings")
type = input.string("SMA", "Smoothing Type", options = ["EMA", "WMA", "RMA", "SMA"], group = "BasicR Settings")
smthper = input.int(5, "Smoothing Period", group = "Basic Settings")
colorbars = input.bool(false, "Color bars?", group = "UI Options")
showsignals = input.bool(false, "Show signals?", group = "UI Options")
ma = ta.sma(close - nz(close[per]), per)
atr = ta.atr(per)
out = ma/atr * 50 + 50
out := smthit ? variant(type, out, smthper) : out
colorout = out > 50 ? greencolor : redcolor
plot(out, color = colorout, linewidth = 2)
barcolor(colorbars ? colorout : na)
middle = 50
plot(middle, color = bar_index % 2 ? color.gray : na)
goLong = ta.crossover(out, middle)
goShort = ta.crossunder(out, middle)
plotshape(goLong and showsignals, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto)
plotshape(goShort and showsignals, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto)
alertcondition(goLong, title="Long", message="Larry Williams Large Trade Index (LWTI) [Loxx]: Long₩nSymbol: {{ticker}}₩nPrice: {{close}}")
alertcondition(goShort, title="Short", message="Larry Williams Large Trade Index (LWTI) [Loxx]: Short₩nSymbol: {{ticker}}₩nPrice: {{close}}")