답변완료
수고하십니다
항상 노고에 감사드리며
변환 부탁드립니다
indicator(title="Range Filter Buy and Sell 5min", shorttitle="Range Filter", overlay=true)
// Color variables
upColor = color.white
midColor = #90bff9
downColor = color.blue
// Source
src = input(defval=close, title="Source")
// Sampling Period
// Settings for 5min chart, BTCUSDC. For Other coin, change the paremeters
per = input.int(defval=100, minval=1, title="Sampling Period")
// Range Multiplier
mult = input.float(defval=3.0, minval=0.1, title="Range Multiplier")
// Smooth Average Range
smoothrng(x, t, m) =>
wper = t * 2 - 1
avrng = ta.ema(math.abs(x - x[1]), t)
smoothrng = ta.ema(avrng, wper) * m
smoothrng
smrng = smoothrng(src, per, mult)
// Range Filter
rngfilt(x, r) =>
rngfilt = x
rngfilt := x > nz(rngfilt[1]) ? x - r < nz(rngfilt[1]) ? nz(rngfilt[1]) : x - r :
x + r > nz(rngfilt[1]) ? nz(rngfilt[1]) : x + r
rngfilt
filt = rngfilt(src, smrng)
// Filter Direction
upward = 0.0
upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1])
downward = 0.0
downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 : nz(downward[1])
// Target Bands
hband = filt + smrng
lband = filt - smrng
// Colors
filtcolor = upward > 0 ? upColor : downward > 0 ? downColor : midColor
barcolor = src > filt and src > src[1] and upward > 0 ? upColor :
src > filt and src < src[1] and upward > 0 ? upColor :
src < filt and src < src[1] and downward > 0 ? downColor :
src < filt and src > src[1] and downward > 0 ? downColor : midColor
filtplot = plot(filt, color=filtcolor, linewidth=2, title="Range Filter")
// Target
hbandplot = plot(hband, color=color.new(upColor, 70), title="High Target")
lbandplot = plot(lband, color=color.new(downColor, 70), title="Low Target")
// Fills
fill(hbandplot, filtplot, color=color.new(upColor, 90), title="High Target Range")
fill(lbandplot, filtplot, color=color.new(downColor, 90), title="Low Target Range")
// Bar Color
barcolor(barcolor)
// Break Outs
longCond = bool(na)
shortCond = bool(na)
longCond := src > filt and src > src[1] and upward > 0 or
src > filt and src < src[1] and upward > 0
shortCond := src < filt and src < src[1] and downward > 0 or
src < filt and src > src[1] and downward > 0
CondIni = 0
CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1]
longCondition = longCond and CondIni[1] == -1
shortCondition = shortCond and CondIni[1] == 1
//Alerts
plotshape(longCondition, title="Buy Signal", text="Buy", textcolor=color.white, style=shape.labelup, size=size.small, location=location.belowbar, color=color.new(#aaaaaa, 20))
plotshape(shortCondition, title="Sell Signal", text="Sell", textcolor=color.white, style=shape.labeldown, size=size.small, location=location.abovebar, color=color.new(downColor, 20))
alertcondition(longCondition, title="Buy alert on Range Filter", message="Buy alert on Range Filter")
alertcondition(shortCondition, title="Sell alert on Range Filter", message="Sell alert on Range Filter")
alertcondition(longCondition or shortCondition, title="Buy and Sell alert on Range Filter", message="Buy and Sell alert on Range Filter")
2024-12-19
560
글번호 186399
지표
답변완료
문의 드립니다
안녕하세요
다음지표에 signal선을 변수을 다르게 두개의 선을 만들고자합니다
변수 변경가능하게 부탁드립니다
input : signal_length(11);
input : sma_signal(true);
input : lin_reg(true);
input : linreg_length(11);
var : bopen(0),bhigh(0),blow(0),bclose(0);
var : r(False),signal(0),buySignal(False),sellSignal(False);
var : tx(0);
bopen = iff(lin_reg , LRL(open, linreg_length) , open);
bhigh = iff(lin_reg , LRL(high, linreg_length) , high);
blow = iff(lin_reg , LRL(low, linreg_length) , low);
bclose = iff(lin_reg , LRL(close, linreg_length), close);
r = bopen < bclose;
signal = iff(sma_signal , ma(bclose, signal_length) , ema(bclose, signal_length));
plot1(signal,"signal");
감사합니다
2024-12-18
531
글번호 186392
지표
답변완료
지표 질문입니다
아래 수식을 9시30분 까지 시간 제한을 풀어서 종가까지 작용하고
글자도 종가 옆에 표출되는 수식으로 수정 부탁 드립니다
감사합니다
-----------------------------------------
var : tx1(0),tx2(0),tx3(0),tx4(0);
if sTime < 093000 Then
{
input : Period(20),dv(2);
var : BBup(0),BBmd(0),BBdn(0),A(0),B(0);
BBup = BollBandUp(Period,dv);
BBmd = ma(c,Period);
BBdn = BollBandDown(Period,dv);
if Bdate != Bdate[1] Then
{
A = bbup;
B = bbdn;
tx1 = Text_New(sDate,sTime,A,NumToStr(A,2));
tx2 = Text_New(sDate,sTime,B,NumToStr(B,2));
tx3 = Text_New(sDate,sTime,A+(A-B),NumToStr(A+(A-B),2));
tx4 = Text_New(sDate,sTime,B-(A-B),NumToStr(B-(A-B),2));
Text_SetStyle(tx1,0,1);
Text_SetStyle(tx2,0,1);
Text_SetStyle(tx3,0,1);
Text_SetStyle(tx4,0,1);
}
if A > 0 and bbup > A Then
A = bbup;
if B > 0 and bbdn< B Then
B = bbdn;
Plot1(A,"H");
plot2(B,"L");
Plot3(A+(A-B),"HL");
plot4(B-(A-B),"LH");
Text_SetString(tx1,NumToStr(A,2));
Text_SetString(tx2,NumToStr(B,2));
Text_SetString(tx3,NumToStr(A+(A-B),2));
Text_SetString(tx4,NumToStr(B-(A-B),2));
Text_SetLocation(tx1,sDate,sTime,A);
Text_SetLocation(tx2,sDate,sTime,B);
Text_SetLocation(tx3,sDate,sTime,A+(A-B));
Text_SetLocation(tx4,sDate,sTime,B-(A-B));
}
Else
{
NoPlot(1);
NoPlot(2);
NoPlot(3);
NoPlot(4);
}
2024-12-18
529
글번호 186390
지표