답변완료
지표 변환부탁드립니다.
// 시가, 고가, 저가 변수
openPrice = open
highPrice = high
lowPrice = low
// 매시간 정시에 해당하는 캔들인지 확인
isHourClose = (minute == 0)
// 양의 조건: 시가가 저가와 같고 저가가 더 이상 갱신되지 않는 경우
isPositive = isHourClose and (openPrice == lowPrice) and (lowPrice == ta.lowest(lowPrice, 1))
// 음의 조건: 시가가 고가와 같고 고가가 더 이상 갱신되지 않는 경우
isNegative = isHourClose and (openPrice == highPrice) and (highPrice == ta.highest(highPrice, 1))
// 텍스트를 저장할 변수
var string ssText = na
// 양의 텍스트 및 선 표시
if (isPositive)
ssText := str.tostring(openPrice)
label.new(bar_index, lowPrice - 1, text=ssText, style=label.style_label_up, color=color.green, textcolor=color.white, size=size.large, textalign=text.align_center)
line.new(bar_index[1], lowPrice, bar_index, lowPrice, color=color.red, width=1)
// 음의 텍스트 및 선 표시
if (isNegative)
ssText := str.tostring(openPrice)
label.new(bar_index, highPrice + 1, text=ssText, style=label.style_label_down, color=color.green, textcolor=color.white, size=size.large, textalign=text.align_center)
line.new(bar_index[1], highPrice, bar_index, highPrice, color=color.blue, width=1)
else
ssText := na // 조건이 충족되지 않으면 텍스트를 비움
답변완료
부탁 좀 드릴께요
항상 감사합니다.
아래 트뷰 지표를 변환하고자 합니다.
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © StratifyTrade
//@version=5
indicator("Liquidity Trendline With Signals [StratifyTrade]", "StratifyTrade - Liquidity Trendline With Signals", overlay = true, max_lines_count = 500, max_bars_back = 5000)
len = input.int (5, "Period",tooltip = "Lookback period", inline = "a", group = "SETTINGS")
cup = input.color(#0044ff, "", "" ,inline = "a", group = "SETTINGS")
cdn = input.color(#ff2b00, "", "" ,inline = "a", group = "SETTINGS")
space = input.float(2, "Padding",tooltip = "Padding distance", inline = "b", group = "SETTINGS", step = 0.1)
shs = input.bool (true, "Show Breakouts",inline = "z", group = "SETTINGS")
ph = ta.pivothigh(high, len, len)
pl = ta.pivotlow (low , len, len)
type store
float src
int n
type bar
float o = open
float h = high
float l = low
float c = close
int n = bar_index
float v = volume
type draw
line[] upln
line[] dnln
var store[] upbin = array.new<store>()
var store[] dnbin = array.new<store>()
var draw d = draw.new(array.new<line>(), array.new<line>())
bar b = bar.new()
atr = ta.atr(200)
method slope(line ln) =>
x = ln.get_x2() - ln.get_x1()
y = ln.get_y2() - ln.get_y1()
y / x
vol() =>
math.min(atr * 0.1, close * (0.1/100))
var bool broken = false
color active = na
bool plup = false
bool pldn = false
if ph
bool remove = false
var bool valid = false
upbin.unshift(store.new(b.h[len], b.n[len]))
if upbin.size() > 1
current = upbin.get(0)
before = upbin.get(1)
if current.src < before.src
if broken
valid := true
else
valid := false
if upbin.size() > 3
pastold = upbin.get(3)
pastcur = upbin.get(2)
now = upbin.get(1)
late = upbin.get(0)
if now.src < pastcur.src and now.src < pastold.src and late.src < pastcur.src and late.src < pastold.src
valid := true
else
valid := false
else
valid := false
if valid
d.upln.unshift(line.new(x1 = before.n, x2 = current.n, y1 = before.src, y2 = current.src, color = cdn))
d.upln.unshift(line.new(x1 = before.n, x2 = current.n, y1 = before.src - vol() * space, y2 = current.src - vol() * space, color = cdn))
ln = d.upln.get(1)
for i = 0 to (b.n - before.n)
slope = ln.slope()
ln.set_x2(b.n[i])
ln.set_y2(ln.get_y2() - slope)
if low[i] > ln.get_y2()
remove := true
break
if remove
d.upln.get(0).delete()
d.upln.get(1).delete()
d.upln .clear()
upbin .clear()
broken := true
else
d.upln.get(0).delete()
d.upln.get(1).delete()
d.upln .clear ()
d.upln.unshift(line.new(x1 = before.n, x2 = current.n, y1 = before.src, y2 = current.src, color = cdn))
d.upln.unshift(line.new(x1 = before.n, x2 = current.n, y1 = before.src - vol() * space, y2 = current.src - vol() * space, color = cdn))
linefill.new(d.upln.get(0), d.upln.get(1), color = color.new(cdn, 75))
upbin.clear()
broken := false
if d.upln.size() > 1
btm = d.upln.get(0)
top = d.upln.get(1)
if b.l > top.get_y2()
d.upln.clear()
broken := true
upbin.clear()
plup := true
if d.upln.size() > 1
slup = top.slope()
sldn = btm.slope()
top.set_x2(b.n)
top.set_y2(top.get_y2() + slup)
btm.set_x2(b.n)
btm.set_y2(btm.get_y2() + sldn)
if pl
bool remove = false
var bool valid = false
dnbin.unshift(store.new(b.l[len], b.n[len]))
if dnbin.size() > 1
current = dnbin.get(0)
before = dnbin.get(1)
if current.src > before.src
if broken
valid := true
else
valid := false
if dnbin.size() > 3
pastold = dnbin.get(3)
pastcur = dnbin.get(2)
now = dnbin.get(1)
late = dnbin.get(0)
if now.src > pastcur.src and now.src > pastold.src and late.src > pastcur.src and late.src > pastold.src
valid := true
else
valid := false
else
valid := false
if valid
d.dnln.unshift(line.new(x1 = before.n, x2 = current.n, y1 = before.src, y2 = current.src , color = cup))
d.dnln.unshift(line.new(x1 = before.n, x2 = current.n, y1 = before.src + vol() * space, y2 = current.src + vol() * space, color = cup))
ln = d.dnln.get(1)
for i = 0 to (b.n - before.n)
slope = ln.slope()
ln.set_x2(b.n[i])
ln.set_y2(ln.get_y2() - slope)
if high[i] < ln.get_y2()
remove := true
break
if remove
d.dnln.get(0).delete()
d.dnln.get(1).delete()
d.dnln .clear ()
dnbin .clear ()
broken := true
else
d.dnln.get(0).delete()
d.dnln.get(1).delete()
d.dnln .clear ()
d.dnln.unshift(line.new(x1 = before.n, x2 = current.n, y1 = before.src, y2 = current.src, color = cup))
d.dnln.unshift(line.new(x1 = before.n, x2 = current.n, y1 = before.src + vol() * space, y2 = current.src + vol() * space, color = cup))
linefill.new(d.dnln.get(0), d.dnln.get(1), color = color.new(cup, 75))
dnbin.clear()
broken := false
if d.dnln.size() > 1
btm = d.dnln.get(0)
top = d.dnln.get(1)
if b.h < btm.get_y2()
d.dnln.clear()
broken := true
dnbin.clear()
pldn := true
if d.dnln.size() > 1
slup = top.slope()
sldn = btm.slope()
top.set_x2(b.n)
top.set_y2(top.get_y2() + slup)
btm.set_x2(b.n)
btm.set_y2(btm.get_y2() + sldn)
plotshape(pldn and shs ? b.h[1] : na, "Breaking Down", shape.triangledown, location = location.abovebar, color = cdn , offset = -1, size = size.tiny)
plotshape(plup and shs ? b.l[1] : na, "Breaking Up" , shape.triangleup , location = location.belowbar, color = cup, offset = -1, size = size.tiny)
2025-08-27
106
글번호 193527
지표
답변완료
수식 추가
Inputs : DDD(20150309), LEN(300), HL_ED(60), CC(Black);
Vars : DBN(0), KK(0), DD(0), KK2(0), DD2(0),T(0),mav(0);
If STime >= 070000 And STime[1] < 070000 Then Begin
DBN = 0;
KK = 0;
DD = 0;
KK2 = 0;
DD2 = 0;
T = 0;
End;
DBN = DBN + 1;
If STime >= 073000 And DD == 0 Then Begin
Value2 = O;
DD = 1;
KK = DBN;
var1 = 0;
var2 = 0;
End;
mav = ma(C,10);
if DD == 1 Then
{
if CrossUp(C,value2) Then
{
T = 1;
}
if CrossDown(C,Value2) Then
{
T = -1;
}
if T == 1 and CrossUp(C,mav) Then
{
T = 2;
Buy();
}
if T == -1 and CrossDown(C,mav) Then
{
T = -2;
Sell();
}
}
안녕하세요
위식에 date 2추가 부탁드려요
분봉에 10분봉이 양봉일때 매수
10분봉이 음봉일때 매도
기존식에서 데이터 2조건이 일치할때 매수,도 방식입니다