답변완료
지표 수식 변환 가능할까요?
//@version=5
indicator("Nadaraya-Watson Envelope [LuxAlgo]", "LuxAlgo - Nadaraya-Watson Envelope", overlay = true, max_lines_count = 500, max_labels_count = 500, max_bars_back=500)
//------------------------------------------------------------------------------
//Settings
//-----------------------------------------------------------------------------{
h = input.float(8.,'Bandwidth', minval = 0)
mult = input.float(3., minval = 0)
src = input(close, 'Source')
repaint = input(true, 'Repainting Smoothing', tooltip = 'Repainting is an effect where the indicators historical output is subject to change over time. Disabling repainting will cause the indicator to output the endpoints of the calculations')
//Style
upCss = input.color(color.teal, 'Colors', inline = 'inline1', group = 'Style')
dnCss = input.color(color.red, '', inline = 'inline1', group = 'Style')
//-----------------------------------------------------------------------------}
//Functions
//-----------------------------------------------------------------------------{
//Gaussian window
gauss(x, h) => math.exp(-(math.pow(x, 2)/(h * h * 2)))
//-----------------------------------------------------------------------------}
//Append lines
//-----------------------------------------------------------------------------{
n = bar_index
var ln = array.new_line(0)
if barstate.isfirst and repaint
for i = 0 to 499
array.push(ln,line.new(na,na,na,na))
//-----------------------------------------------------------------------------}
//End point method
//-----------------------------------------------------------------------------{
var coefs = array.new_float(0)
var den = 0.
if barstate.isfirst and not repaint
for i = 0 to 499
w = gauss(i, h)
coefs.push(w)
den := coefs.sum()
out = 0.
if not repaint
for i = 0 to 499
out += src[i] * coefs.get(i)
out /= den
mae = ta.sma(math.abs(src - out), 499) * mult
upper = out + mae
lower = out - mae
//-----------------------------------------------------------------------------}
//Compute and display NWE
//-----------------------------------------------------------------------------{
float y2 = na
float y1 = na
nwe = array.new<float>(0)
if barstate.islast and repaint
sae = 0.
//Compute and set NWE point
for i = 0 to math.min(499,n - 1)
sum = 0.
sumw = 0.
//Compute weighted mean
for j = 0 to math.min(499,n - 1)
w = gauss(i - j, h)
sum += src[j] * w
sumw += w
y2 := sum / sumw
sae += math.abs(src[i] - y2)
nwe.push(y2)
sae := sae / math.min(499,n - 1) * mult
for i = 0 to math.min(499,n - 1)
if i%2
line.new(n-i+1, y1 + sae, n-i, nwe.get(i) + sae, color = upCss)
line.new(n-i+1, y1 - sae, n-i, nwe.get(i) - sae, color = dnCss)
if src[i] > nwe.get(i) + sae and src[i+1] < nwe.get(i) + sae
label.new(n-i, src[i], '▼', color = color(na), style = label.style_label_down, textcolor = dnCss, textalign = text.align_center)
if src[i] < nwe.get(i) - sae and src[i+1] > nwe.get(i) - sae
label.new(n-i, src[i], '▲', color = color(na), style = label.style_label_up, textcolor = upCss, textalign = text.align_center)
y1 := nwe.get(i)
2023-12-12
1269
글번호 174782
지표
답변완료
아래의 수식을 5분봉검색식으로 변환하여 사용하려합니다.
아래의 수식을 5분봉검색식으로 변환하여 사용하려합니다
5분봉 수식으로 변환하여 사용되게 검색식 부탁드림니다.
input : period(20),비율(1.01);
Var : var1(0),var2(0),var3(0),var4(0),var5(0),AA(0),AA1(0),AA2(0),AA3(0),AA4(0),BB(0),BB1(0);
var1 = Ema(C, period);
var2 = Ema(C, period+5);
var3 = Ema(C, period+10);
var4 = Ema(C, period+15);
var5 = Ema(C, period+20);
if var1 >= var1[1] Then AA = var1;
if var2 >= var2[1] Then AA1 = var2;
if var3 >= var3[1] Then AA2 = var3;
if var4 >= var4[1] Then AA3 = var4;
if var5 >= var5[1] Then AA4 = var5;
BB=MAX(AA,AA1,AA2,AA3,AA4);
BB1=MIN(AA,AA1,AA2,AA3,AA4);
IF BB1*비율>=BB && CrossUp(C,BB) TheN
Find(1);
2023-12-12
1369
글번호 174781
종목검색
답변완료
수식을 부탁드립니다
input : Periods(10),Multiplier(3.0),changeATR(true),showsignals(true),highlighting(true);
var : src(0),ATr2(0),ATrv(0),upv(0),up1(0),dnv(0),dn1(0);
var : trend(0),tx(0);
src = (h+l)/2;
atr2 = ma(TrueRange, Periods);
atrv = iff(changeATR , atr(Periods) , atr2);
upv = src-(Multiplier*atrv);
up1 = iff(IsNaN(upv[1]) == False,upv[1],upv);
upv = iff(close[1] > up1 , max(upv,up1) , upv);
dnv =src+(Multiplier*atrv);
dn1 = iff(isnan(dnv[1]) == False,dnv[1], dnv);
dnv = iff(close[1] < dn1 , min(dnv, dn1) , dnv);
trend = 1;
trend = iff(IsNaN(trend[1]) == False,trend[1], trend);
trend = iff(trend == -1 and close > dn1 , 1 , IFf( trend == 1 and close < up1 , -1 , trend));
if trend == 1 Then
{
plot1(upv,"UpTrend",green);
NoPlot(2);
if trend == 1 and trend[1] == -1 Then
{
tx = Text_New(sDate,sTime,upv,"▲");
Text_SetStyle(tx,2,0);
Text_SetColor(tx,Red);
}
}
Else
{
NoPlot(1);
plot2(dnv, "Down Trend",red);
if trend == -1 and trend[1] == 1 Then
{
tx = Text_New(sDate,sTime,dnv,"▼");
Text_SetStyle(tx,2,1);
Text_SetColor(tx,Blue);
}
}
________________________________
위 수식에서 빨강 화살표가 나올때 검색할 수 있을까요?
부탁드립니다. 감사합니다.
2023-12-12
1026
글번호 174774
종목검색
답변완료
부탁드립니다
1. 종가가 2개 이상 연속된 음봉이면서 30개 봉의 최저가 이하로 내려가면 매도하라, 그리고 매도 진입한 봉의 직전 2개봉의 최고가 이상으로 오르거나, 또는 2개 이상 연속된 양봉이 나타나면 청산하라
2. 종가가 1개 이상 연속된 양봉이면서 가장 최근의 1개 이상 연속된 양봉의 최고가보다 높으면 빨강색으로, 종가가 1개 이상 연속된 음봉이면서 가장 최근의 1개 이상 연속된 음봉의 최저가보다 낮으면 파란색으로 구현해 주세요
3. 종가가 1개 이상 연속된 양봉이면서 가장 최근의 1개 이상 연속된 음봉 합의 최고가보다 높고, 동시에 가장 최근의 1개 이상 연속된 양봉 합의 최고가보다 높으면 빨강색으로, 종가가 1개 이상 연속된 음봉이면서 가장 최근의 1개 이상 연속된 양봉 합의 최저가보다 낮고, 동시에 가장 최근의 1개 이상 연속된 음봉 합의 최저가보다 낮으면 파란색으로 구현해 주세요
4. 종가가 1개 이상 연속된 양봉이면서 그 합의 거래량이 가장 최근의 1개 이상 연속된 음봉 합의 거래량 보다 많은 경우에는 빨강색으로, 종가가 1개 이상 연속된 음봉이면서 그 합의 거래량이 가장 최근의 1개 이상 연속된 양봉 합의 거래량보다 많은 경우에는 파란색으로 구현해 주세요
고맙습니다.
2023-12-12
1005
글번호 174765
시스템