커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1541
글번호 230811
답변완료
부탁드립니다
수고하십니다
아래수식을 예스로 부탁드립니다
/ 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/
// © LuxAlgo
//@version=5
indicator("Pure Price Action ICT Tools [LuxAlgo]", 'LuxAlgo - Pure Price Action ICT Tools', true, calc_bars_count = 2000, max_labels_count = 500, max_boxes_count = 500, max_lines_count = 500)
//---------------------------------------------------------------------------------------------------------------------
// Settings
//---------------------------------------------------------------------------------------------------------------------{
display = display.all - display.status_line
msGroup = 'Market Structures'
msShow = input.bool (true, 'Market Structures', group = msGroup)
msTerm = input.string('Intermediate Term', '  Detection', options = ['Short Term', 'Intermediate Term', 'Long Term'], group = msGroup)
msTextT = input.string('Enabled', '  Market Structure Labels', options = ['Enabled', 'Disabled'], group = msGroup, display = display), msText = msTextT == 'Enabled'
msLineStyle = input.string('Solid', '  Line Style', options = ['Solid', 'Dashed', 'Dotted'], group = msGroup, display = display)
msBullColor = input.color(#089981, '  Line Colors, Bullish', group = msGroup, inline = 'MS')
msBearColor = input.color(#f23645, 'Bearish', group = msGroup, inline = 'MS')
obbGroup = 'Order & Breaker Blocks'
obbShow = input.bool (true, 'Order & Breaker Blocks', group = obbGroup)
obbTerm = input.string('Long Term', '  Detection', options = ['Short Term', 'Intermediate Term', 'Long Term'], group = obbGroup, display = display)
obbBullLast = input.int(3, '  Last Bullish Blocks', minval = 0, group = obbGroup, display = display)
obbBearLast = input.int(3, '  Last Bearish Blocks', minval = 0, group = obbGroup, display = display)
obbUseBodyT = input.string('Enabled', '  Use Candle Body', options = ['Enabled', 'Disabled'], group = obbGroup, display = display), obbUseBody = obbUseBodyT == 'Enabled'
obbBullColor = input(color.new(#089981, 73), '  Bullish OB ' , inline = 'bullC', group = obbGroup)
obbBullBreakColor = input(color.new(#f23645, 41), 'Bullish Break ', inline = 'bullC', group = obbGroup)
obbBearColor = input(color.new(#f23645, 73), '  Bearish OB' , inline = 'bearC', group = obbGroup)
obbBearBreakColor = input(color.new(#089981, 41), 'Bearish Break', inline = 'bearC', group = obbGroup)
liqGroup = 'Buyside & Sellside Liquidity'
liqBuySell = input.bool (true, 'Buyside & Sellside Liquidity', group = liqGroup)
liqTerm = input.string('Intermediate Term', '  Detection', options = ['Short Term', 'Intermediate Term', 'Long Term'], group = liqGroup)
liqMar = 10 / input.float (6.9, '  Margin', minval = 4, maxval = 9, step = 0.1, group = liqGroup, display = display)
cLIQ_B = input.color (#089981, '  Line Colors, Buyside', inline = 'LIQ', group = liqGroup)
cLIQ_S = input.color (#f23645, 'Sellside', inline = 'LIQ', group = liqGroup)
visLiq = input.int (3, '  Visible Levels', minval = 1, maxval = 50, group = liqGroup, display = display)
liqGrp = 'Liquidity Voids'
lqVoid = input.bool (true, 'Liquidity Voids', group = liqGrp)
lqThresh = input.float(.75, '  Threshold Multiplier', minval = .05, step = .05, group = liqGrp, display = display)
lqMode = input.string('Present', '  Mode', options =['Present', 'Historical'], inline = 'MD', group = liqGrp, display = display)
lqPeriod = input.int(360, ' ', inline = 'MD', group = liqGrp, display = display)
cLQV_B = input.color (#B2B5BE41, '  Bullish Zones', inline = 'void', group = liqGrp)
cLQV_S = input.color (#5D606B41, ' Bearish Zones', inline = 'void', group = liqGrp)
lqTextT = input.string('Disabled', '  Liquidity Void Labels', options = ['Enabled', 'Disabled'], group = liqGrp, display = display), lqText = lqTextT == 'Enabled'
swGroup = 'Swing Highs/Lows'
swShow = input.bool (true, 'Swing Highs/Lows', group = swGroup)
swTerm = input.string('Long Term', '  Detection', options = ['Short Term', 'Intermediate Term', 'Long Term'], group = swGroup)
swSwingsSZ = input.string('Tiny', '  Label Size', options = ['Tiny', 'Small', 'Normal'], group = swGroup, display = display)
swBullColor = input.color(#089981, '  Label Colors, Bullish', group = swGroup, inline = 'MS')
swBearColor = input.color(#f23645, 'Bearish', group = swGroup, inline = 'MS')
//---------------------------------------------------------------------------------------------------------------------}
// User Defined Types
//---------------------------------------------------------------------------------------------------------------------{
type BAR
float open = open
float high = high
float low = low
float close = close
int index = bar_index
type ICTMS
float lastPrice
float midPrice
float prevPrice
int lastIndex
int midIndex
int prevIndex
label lastLabel
label midLabel
label prevLabel
bool isCrossed
bool isConfirmed
int marketStructure
line msLine
box msLabel
box swpBox
type MS
int type = 0
type ZZ
int [] d
int [] x
float [] y
type liq
box bx
box bxz
box bxt
bool brZ
bool brL
line ln
line lne
type ob
float top = na
float btm = na
int loc = bar_indexa
bool breaker = false
int break_loc = na
type SWING
float y = na
int x = na
bool crossed = false
type vector
array<SWING> v
type htfBar
float price = na
int index = na
//---------------------------------------------------------------------------------------------------------------------}
// Generic Variables
//---------------------------------------------------------------------------------------------------------------------{
BAR bar = BAR.new()
var bxOBB = array.new_box()
var lnOBB = array.new_line()
//---------------------------------------------------------------------------------------------------------------------}
// Functions / Methods
//---------------------------------------------------------------------------------------------------------------------{
textSize(sizeInText) =>
switch sizeInText
'Tiny' => size.tiny
'Small' => size.small
'Normal' => size.normal
=> size.large
lineStyle(styleInText) =>
switch styleInText
'Solid' => line.style_solid
'Dotted' => line.style_dotted
'Dashed' => line.style_dashed
timeframe(userTimeframe) =>
float chartTFinM = timeframe.in_seconds() / 60
switch
userTimeframe == "Auto" and chartTFinM <= 60 => 'D'
userTimeframe == "Auto" and chartTFinM <= 1440 => 'W'
userTimeframe == "5 Minutes" and chartTFinM <= 5 => '5'
userTimeframe == "15 Minutes" and chartTFinM <= 15 => '15'
userTimeframe == "1 Hour" and chartTFinM <= 60 => '60'
userTimeframe == "4 Hours" and chartTFinM <= 240 => '240'
userTimeframe == "1 Day" and timeframe.isintraday => 'D'
(userTimeframe == "Auto" or userTimeframe == "1 Week") and (timeframe.isdaily or timeframe.isintraday) => 'W'
(userTimeframe == "Auto" or userTimeframe == "1 Month") and (timeframe.isweekly or timeframe.isdaily or timeframe.isintraday) => 'M'
=> timeframe.period
queryPatterns(lastPrice, midPrice, prevPrice, isSwingHigh) =>
if isSwingHigh
prevPrice < midPrice and midPrice >= lastPrice
else
prevPrice > midPrice and midPrice <= lastPrice
method queryPatterns(ICTMS this, isSwingHigh) =>
if isSwingHigh
this.prevPrice < this.midPrice and this.midPrice >= this.lastPrice
else
this.prevPrice > this.midPrice and this.midPrice <= this.lastPrice
method UP DATRPattern(ICTMS this, price, index) =>
this.isCrossed := false
this.prevPrice := this.midPrice, this.midPrice := this.lastPrice, this.lastPrice := price
this.prevIndex := this.midIndex, this.midIndex := this.lastIndex, this.lastIndex := index
this.prevLabel := this.midLabel, this.midLabel := this.lastLabel
method setType(MS this, value) =>
this.type := value
method renderStructures(ICTMS this, isBullish, marketStructure, color, style, labelEnabled) =>
condition = isBullish ? bar.close > this.lastPrice : bar.close < this.lastPrice
if condition and not this.isCrossed
this.isCrossed := true
this.isConfirmed := false
this.msLine := line.new(this.lastIndex, this.lastPrice, bar.index, this.lastPrice, color = color, style = lineStyle(style))
this.swpBox := box.new(bar.index, this.lastPrice, bar.index, this.lastPrice, color.new(color, 73), bgcolor = color.new(color, 73))
if labelEnabled
this.msLabel := box.new(this.lastIndex, this.lastPrice, bar.index, this.lastPrice, color(na), bgcolor = color(na),
text = marketStructure.type == (isBullish ? -1 : 1) ? 'MSS' : 'BOS', text_size = size.tiny, text_halign = text.align_left, text_valign = isBullish ? text.align_bottom : text.align_top, text_color = color.new(color, 17))
marketStructure.setType(isBullish ? 1 : -1)
method in_out(ZZ aZZ, int _d, int _x, float _y) =>
aZZ.d.unshift(_d), aZZ.x.unshift(_x), aZZ.y.unshift(_y), aZZ.d.pop(), aZZ.x.pop(), aZZ.y.pop()
method detectSwings(array<vector> id, mode, depth)=>
var SWING swingLevel = SWING.new(na, na)
for i = 0 to depth - 1
get_v = id.get(i).v
if get_v.size() == 3
pivot = switch mode
'bull' => math.max(get_v.get(0).y, get_v.get(1).y, get_v.get(2).y)
'bear' => math.min(get_v.get(0).y, get_v.get(1).y, get_v.get(2).y)
if pivot == get_v.get(1).y
if i < depth - 1
id.get(i+1).v.unshift(get_v.get(1))
if id.get(i+1).v.size() > 3
id.get(i+1).v.pop()
else
swingLevel := SWING.new(get_v.get(1).y, get_v.get(1).x)
get_v.pop()
get_v.pop()
swingLevel
method renderBlocks(ob id, color, breakColor)=>
avg = math.avg(id.top, id.btm)
if id.breaker
bxOBB.push(box.new(id.loc, id.top, id.break_loc, id.btm, color, bgcolor = color, xloc = xloc.bar_time))
lnOBB.push(line.new(id.break_loc, id.top, timenow, id.top, xloc.bar_time, extend.none, breakColor))
lnOBB.push(line.new(id.break_loc, id.btm, timenow, id.btm, xloc.bar_time, extend.none, breakColor))
lnOBB.push(line.new(id.loc, avg, timenow, avg, xloc.bar_time, extend.none, breakColor, style = line.style_dotted))
if not id.breaker
bxOBB.push(box.new(id.loc, id.top, timenow, id.btm, na, bgcolor = color, extend = extend.none, xloc = xloc.bar_time))
lnOBB.push(line.new(id.loc, id.top, timenow, id.top, xloc.bar_time, extend.none, color))
lnOBB.push(line.new(id.loc, id.btm, timenow, id.btm, xloc.bar_time, extend.none, color))
lnOBB.push(line.new(id.loc, avg, timenow, avg, xloc.bar_time, extend.none, breakColor, style = line.style_dotted))
//---------------------------------------------------------------------------------------------------------------------}
// Calculations - Swings
//---------------------------------------------------------------------------------------------------------------------{
var ICTMS stLow = ICTMS.new()
var ICTMS stHigh = ICTMS.new()
var MS stMS = MS.new()
if queryPatterns(bar.low, bar.low[1], bar.low[2], false)
stLow.UP DATRPattern(bar.low[1], bar.index[1])
stLow.lastLabel := label.new(stLow.lastIndex, stLow.lastPrice, '⦁', color = color(na), textcolor = swShow and swTerm == 'Short Term' ? swBearColor : color(na), style = label.style_label_up, size = textSize(swSwingsSZ), tooltip = str.tostring(stLow.lastPrice, format.mintick))
if queryPatterns(bar.high, bar.high[1], bar.high[2], true)
stHigh.UP DATRPattern(bar.high[1], bar.index[1])
stHigh.lastLabel := label.new(bar.index[1], bar.high[1], '⦁', color = color(na), textcolor = swShow and swTerm == 'Short Term' ? swBullColor : color(na), style = label.style_label_down, size = textSize(swSwingsSZ), tooltip = str.tostring(bar.high[1], format.mintick))
var ICTMS itLow = ICTMS.new()
var ICTMS itHigh = ICTMS.new()
var MS itMS = MS.new()
cITL = stLow.queryPatterns(false)
if cITL and cITL != cITL[1]
itLow.UP DATRPattern(stLow.midPrice, stLow.midIndex)
itLow.lastLabel := stLow.midLabel
if swShow and swTerm == 'Intermediate Term'
stLow.midLabel.set_size(textSize(swSwingsSZ))
stLow.midLabel.set_textcolor(swBearColor)
cITH = stHigh.queryPatterns(true)
if cITH and cITH != cITH[1]
itHigh.UP DATRPattern(stHigh.midPrice, stHigh.midIndex)
itHigh.lastLabel := stHigh.midLabel
if swShow and swTerm == 'Intermediate Term'
stHigh.midLabel.set_size(textSize(swSwingsSZ))
stHigh.midLabel.set_textcolor(swBullColor)
var ICTMS ltLow = ICTMS.new()
var ICTMS ltHigh = ICTMS.new()
var MS ltMS = MS.new()
cLTL = itLow.queryPatterns(false)
if cLTL and cLTL != cLTL[1]
ltLow.isCrossed := false
ltLow.lastPrice := itLow.midPrice
ltLow.lastIndex := itLow.midIndex
if swShow and swTerm == 'Long Term'
itLow.midLabel.set_size(textSize(swSwingsSZ))
itLow.midLabel.set_textcolor(swBearColor)
cLTH = itHigh.queryPatterns(true)
if cLTH and cLTH != cLTH[1]
ltHigh.isCrossed := false
ltHigh.lastPrice := itHigh.midPrice
ltHigh.lastIndex := itHigh.midIndex
if swShow and swTerm == 'Long Term'
itHigh.midLabel.set_size(textSize(swSwingsSZ))
itHigh.midLabel.set_textcolor(swBullColor)
//---------------------------------------------------------------------------------------------------------------------}
// Calculations - Market Structures
//---------------------------------------------------------------------------------------------------------------------{
if msShow
if msTerm == 'Short Term'
stLow.renderStructures(false, stMS, msBearColor, msLineStyle, msText)
stHigh.renderStructures(true, stMS, msBullColor, msLineStyle, msText)
if msTerm == 'Intermediate Term'
itLow.renderStructures(false, itMS, msBearColor, msLineStyle, msText)
itHigh.renderStructures(true, itMS, msBullColor, msLineStyle, msText)
if msTerm == 'Long Term'
ltLow.renderStructures(false, ltMS, msBearColor, msLineStyle, msText)
ltHigh.renderStructures(true, ltMS, msBullColor, msLineStyle, msText)
//---------------------------------------------------------------------------------------------------------------------}
// Calculations - Buyside & Sellside Liquidity
//---------------------------------------------------------------------------------------------------------------------{
maxSize = 50
atr = ta.atr(10)
var ZZ aZZ = ZZ.new(
array.new <int> (maxSize, 0),
array.new <int> (maxSize, 0),
array.new <float>(maxSize, na)
)
var liq[] b_liq_B = array.new<liq> (1, liq.new(box(na), box(na), box(na), false, false, line(na), line(na)))
var liq[] b_liq_S = array.new<liq> (1, liq.new(box(na), box(na), box(na), false, false, line(na), line(na)))
var b_liq_V = array.new_box()
var int dir = na, var int x1 = na, var float y1 = na, var int x2 = na, var float y2 = na
[topLQ, btmLQ] = switch liqTerm
'Short Term' => [SWING.new(stHigh.lastPrice, stHigh.lastIndex), SWING.new(stLow.lastPrice, stLow.lastIndex)]
'Intermediate Term' => [SWING.new(itHigh.lastPrice, itHigh.lastIndex), SWING.new(itLow.lastPrice, itLow.lastIndex)]
'Long Term' => [SWING.new(ltHigh.lastPrice, ltHigh.lastIndex), SWING.new(ltLow.lastPrice, ltLow.lastIndex)]
if not liqBuySell
topLQ := SWING.new(0, 0)
btmLQ := SWING.new(0, 0)
swingHigh = topLQ.y
swingLow = btmLQ.y
x2 := bar.index - 1
if swingHigh > 0 and swingHigh != swingHigh[1]
dir := aZZ.d.get(0)
x1 := aZZ.x.get(0)
x2 := topLQ.x
y1 := aZZ.y.get(0)
y2 := swingHigh//nz(bar.high[1])
if dir < 1
aZZ.in_out(1, x2, y2)
else
if dir == 1 and swingHigh > y1
aZZ.x.set(0, x2), aZZ.y.set(0, y2)
if true
count = 0
st_P = 0.
st_B = 0
minP = 0.
maxP = 10e6
for i = 0 to maxSize - 1
if aZZ.d.get(i) == 1
if aZZ.y.get(i) > swingHigh + (atr / liqMar)
break
else
if aZZ.y.get(i) > swingHigh - (atr / liqMar) and aZZ.y.get(i) < swingHigh + (atr / liqMar)
count += 1
st_B := aZZ.x.get(i)
st_P := aZZ.y.get(i)
if aZZ.y.get(i) > minP
minP := aZZ.y.get(i)
if aZZ.y.get(i) < maxP
maxP := aZZ.y.get(i)
if count > 2
getB = b_liq_B.get(0)
if st_B == getB.bx.get_left()
getB.bx.set_top(math.avg(minP, maxP) + (atr / liqMar))
getB.bx.set_rightbottom(bar.index + 10, math.avg(minP, maxP) - (atr / liqMar))
else
b_liq_B.unshift(
liq.new(
box.new(st_B, math.avg(minP, maxP) + (atr / liqMar), bar.index + 10, math.avg(minP, maxP) - (atr / liqMar), bgcolor=color(na), border_color=color(na)),
box.new(na, na, na, na, bgcolor = color(na), border_color = color(na)),
box.new(st_B, st_P, bar.index + 10, st_P, text = 'Buyside liquidity', text_size = size.tiny, text_halign = text.align_left, text_valign = text.align_bottom, text_color = color.new(cLIQ_B, 25), bgcolor = color(na), border_color = color(na)),
false,
false,
line.new(st_B , st_P, bar.index - 1, st_P, color = color.new(cLIQ_B, 0)),
line.new(bar.index - 1, st_P, na , st_P, color = color.new(cLIQ_B, 0), style = line.style_dotted))
)
if b_liq_B.size() > visLiq
getLast = b_liq_B.pop()
getLast.bx.delete()
getLast.bxz.delete()
getLast.bxt.delete()
getLast.ln.delete()
getLast.lne.delete()
if swingLow > 0 and swingLow != swingLow[1]
dir := aZZ.d.get (0)
x1 := aZZ.x.get (0)
x2 := btmLQ.x
y1 := aZZ.y.get (0)
y2 := swingLow//nz(bar.low[1])
if dir > -1
aZZ.in_out(-1, x2, y2)
else
if dir == -1 and swingLow < y1
aZZ.x.set(0, x2), aZZ.y.set(0, y2)
if true
count = 0
st_P = 0.
st_B = 0
minP = 0.
maxP = 10e6
for i = 0 to maxSize - 1
if aZZ.d.get(i) == -1
if aZZ.y.get(i) < swingLow - (atr / liqMar)
break
else
if aZZ.y.get(i) > swingLow - (atr / liqMar) and aZZ.y.get(i) < swingLow + (atr / liqMar)
count += 1
st_B := aZZ.x.get(i)
st_P := aZZ.y.get(i)
if aZZ.y.get(i) > minP
minP := aZZ.y.get(i)
if aZZ.y.get(i) < maxP
maxP := aZZ.y.get(i)
if count > 2
getB = b_liq_S.get(0)
if st_B == getB.bx.get_left()
getB.bx.set_top(math.avg(minP, maxP) + (atr / liqMar))
getB.bx.set_rightbottom(bar.index + 10, math.avg(minP, maxP) - (atr / liqMar))
else
b_liq_S.unshift(
liq.new(
box.new(st_B, math.avg(minP, maxP) + (atr / liqMar), bar.index + 10, math.avg(minP, maxP) - (atr / liqMar), bgcolor=color(na), border_color=color(na)),
box.new(na, na, na, na, bgcolor=color(na), border_color=color(na)),
box.new(st_B, st_P, bar.index + 10, st_P, text = 'Sellside liquidity', text_size = size.tiny, text_halign = text.align_left, text_valign = text.align_top, text_color = color.new(cLIQ_S, 25), bgcolor=color(na), border_color=color(na)),
false,
false,
line.new(st_B , st_P, bar.index - 1, st_P, color = color.new(cLIQ_S, 0)),
line.new(bar.index - 1, st_P, na , st_P, color = color.new(cLIQ_S, 0), style = line.style_dotted))
)
if b_liq_S.size() > visLiq
getLast = b_liq_S.pop()
getLast.bx.delete()
getLast.bxz.delete()
getLast.bxt.delete()
getLast.ln.delete()
getLast.lne.delete()
for i = 0 to b_liq_B.size() - 1
x = b_liq_B.get(i)
if not x.brL
x.lne.set_x2(bar.index)
if bar.high > x.bx.get_top()
x.brL := true
for i = 0 to b_liq_S.size() - 1
x = b_liq_S.get(i)
if not x.brL
x.lne.set_x2(bar.index)
if bar.low < x.bx.get_bottom()
x.brL := true
//---------------------------------------------------------------------------------------------------------------------}
// Calculations - Liquidity Voids
//---------------------------------------------------------------------------------------------------------------------{
atr200 = ta.atr(200) * lqThresh
dispPeriod = lqMode == 'Present' ? last_bar_index - bar_index <= lqPeriod : true
if lqVoid and dispPeriod
bull = bar.low - bar.high[2] > atr200 and bar.low > bar.high[2] and bar.close[1] > bar.high[2]
bear = bar.low[2] - bar.high > atr200 and bar.high < bar.low[2] and bar.close[1] < bar.low[2]
if bull
l = 13
if bull[1]
st = math.abs(bar.low - bar.low[1]) / l
for i = 0 to l - 1
b_liq_V.push(box.new(bar.index - 2, bar.low[1] + i * st, bar.index, bar.low[1] + (i + 1) * st, border_color = na, bgcolor = cLQV_B ))
else
st = math.abs(bar.low - bar.high[2]) / l
for i = 0 to l - 1
if lqText and i == 0
array.push(b_liq_V, box.new(bar.index - 2, bar.high[2] + i * st, bar.index, bar.high[2] + (i + 1) * st, text = 'Liquidity Void ', text_size = size.tiny, text_halign = text.align_right, text_valign = text.align_bottom, text_color = na, border_color = na, bgcolor = cLQV_B ))
else
array.push(b_liq_V, box.new(bar.index - 2, bar.high[2] + i * st, bar.index, bar.high[2] + (i + 1) * st, border_color = na, bgcolor = cLQV_B ))
if bear
l = 13
if bear[1]
st = math.abs(bar.high[1] - bar.high) / l
for i = 0 to l - 1
array.push(b_liq_V, box.new(bar.index - 2, bar.high + i * st, bar.index, bar.high + (i + 1) * st, border_color = na, bgcolor = cLQV_S ))
else
st = math.abs(bar.low[2] - bar.high) / l
for i = 0 to l - 1
if lqText and i == l - 1
array.push(b_liq_V, box.new(bar.index - 2, bar.high + i * st, bar.index, bar.high + (i + 1) * st, text = 'Liquidity Void ', text_size = size.tiny, text_halign = text.align_right, text_valign = text.align_top, text_color = na, border_color = na, bgcolor = cLQV_S ))
else
array.push(b_liq_V, box.new(bar.index - 2, bar.high + i * st, bar.index, bar.high + (i + 1) * st, border_color = na, bgcolor = cLQV_S ))
if b_liq_V.size() > 0
qt = b_liq_V.size()
for bn = qt - 1 to 0
if bn < b_liq_V.size()
cb = b_liq_V.get(bn)
ba = math.avg(cb.get_bottom(), cb.get_top())
if math.sign(bar.close[1] - ba) != math.sign(bar.close - ba) or math.sign(bar.close[1] - ba) != math.sign(bar.low - ba) or math.sign(bar.close[1] - ba) != math.sign(bar.high - ba)
b_liq_V.remove(bn)
else
cb.set_right(bar.index + 1)
if bar.index - cb.get_left() > 21
cb.set_text_color(color.new(chart.fg_color, 25))
//---------------------------------------------------------------------------------------------------------------------}
// Order & Breaker Blocks
//---------------------------------------------------------------------------------------------------------------------{
depth = switch obbTerm
'Short Term' => 1
'Intermediate Term' => 2
'Long Term' => 3
var fractalHigh = array.new<vector>(0)
var fractalLow = array.new<vector>(0)
if barstate.isfirst
for i = 0 to depth - 1
fractalHigh.push(vector.new(array.new<SWING>(0)))
fractalLow.push(vector.new(array.new<SWING>(0)))
fractalHigh.get(0).v.unshift(SWING.new(bar.high, bar.index))
fractalLow.get(0).v.unshift(SWING.new(bar.low, bar.index))
if fractalHigh.get(0).v.size() > 3
fractalHigh.get(0).v.pop()
if fractalLow.get(0).v.size() > 3
fractalLow.get(0).v.pop()
top = fractalHigh.detectSwings('bull', depth)
btm = fractalLow.detectSwings('bear', depth)
if obbShow
max = obbUseBody ? math.max(bar.close, bar.open) : bar.high
min = obbUseBody ? math.min(bar.close, bar.open) : bar.low
var bullish_ob = array.new<ob>(0)
if bar.close > top.y and not top.crossed
top.crossed := true
minima = max[1]
maxima = min[1]
loc = time[1]
for i = 1 to (bar.index - top.x) - 1
minima := math.min(min[i], minima)
maxima := minima == min[i] ? max[i] : maxima
loc := minima == min[i] ? time[i] : loc
bullish_ob.unshift(ob.new(maxima, minima, loc))
if bullish_ob.size() > 100//obbBullLast
bullish_ob.pop()
if bullish_ob.size() > 0
for i = bullish_ob.size() - 1 to 0
element = bullish_ob.get(i)
if not element.breaker
if math.min(bar.close, bar.open) < element.btm
element.breaker := true
element.break_loc := time
else
if bar.close > element.top
bullish_ob.remove(i)
var bearish_ob = array.new<ob>(0)
if bar.close < btm.y and not btm.crossed
btm.crossed := true
minima = min[1]
maxima = max[1]
loc = time[1]
for i = 1 to (bar.index - btm.x) - 1
maxima := math.max(max[i], maxima)
minima := maxima == max[i] ? min[i] : minima
loc := maxima == max[i] ? time[i] : loc
bearish_ob.unshift(ob.new(maxima, minima, loc))
if bearish_ob.size() > 100//obbBearLast
bearish_ob.pop()
if bearish_ob.size() > 0
for i = bearish_ob.size() - 1 to 0
element = bearish_ob.get(i)
if not element.breaker
if math.max(bar.close, bar.open) > element.top
element.breaker := true
element.break_loc := time
else
if bar.close < element.btm
bearish_ob.remove(i)
if bxOBB.size() > 0
for i = 0 to bxOBB.size() - 1
box.delete(bxOBB.shift())
if lnOBB.size() > 0
for i = 0 to lnOBB.size() - 1
line.delete(lnOBB.shift())
if barstate.islast
if obbBullLast > 0 and bullish_ob.size() > 0
for i = 0 to math.min(obbBullLast - 1, bullish_ob.size() - 1)
get_ob = bullish_ob.get(i)
get_ob.renderBlocks(obbBullColor, obbBullBreakColor)
if obbBearLast > 0 and bearish_ob.size() > 0
for i = 0 to math.min(obbBearLast - 1, bearish_ob.size() - 1)
get_ob = bearish_ob.get(i)
get_ob.renderBlocks(obbBearColor, obbBearBreakColor)
//---------------------------------------------------------------------------------------------------------------------}
2025-06-11
634
글번호 191641
답변완료
시스템 코드 오류 해결방안 수정 가능한가요?
// 지표 설정
Var: Period(20); // 거래량 평균 계산 기간
Var: VolDecreaseRatio(0.7); // 조정 시 거래량 감소 비율
Var: VolIncreaseRatio(1.5); // 변곡점 양봉 시 거래량 증가 비율
Var: AdjustDays(5); // 최소 조정 일수
Var: RangeThreshold(0.02); // 횡보 판단 기준
Var: CandleSizeRatio(2.0); // 장대 양봉 기준
Var: MASupportRange(0.02); // 이평선 지지 범위
Var: D(0); // 루프 변수
Var: Condition1(false); // 횡보 후 장대 양봉 조건
Var: Condition2(false); // 조정 기간 조건
Var: Condition3(false); // 거래량 바닥 조건
Var: Condition4(false); // 변곡점 양봉 조건
Var: Condition5(false); // 이평선 지지 조건
// 이동평균선
Var: MA5(0);
Var: MA10(0);
MA5 = Average(Close, 5);
MA10 = Average(Close, 10);
// 평균 캔들 길이
Var: AvgCandleSize(0);
AvgCandleSize = Average(High - Low, 20);
// 1. 횡보 후 장대 양봉
Var: High10(0);
Var: Low10(0);
High10 = Highest(High, 10)[5];
Low10 = Lowest(Low, 10)[5];
Condition1 = false;
If High10 - Low10 <= Close[5] * RangeThreshold Then
If Close[4] > Open[4] And (High[4] - Low[4]) >= AvgCandleSize * CandleSizeRatio Then
Condition1 = true;
End;
End;
// 2. 조정 기간: 5일 이상 하락 및 거래량 감소
Condition2 = true;
For D = 1 To AdjustDays
If Close[D] >= Close[D-1] or Volume[D] >= Average(Volume, Period) * VolDecreaseRatio Then
Condition2 = false;
Break;
End;
End;
// 3. 거래량 바닥
Var: MinVolume(0);
MinVolume = Lowest(Volume, AdjustDays);
Condition3 = MinVolume <= Average(Volume, Period) * VolDecreaseRatio;
// 4. 변곡점 양봉
Condition4 = Close > Open And Volume >= Average(Volume, Period) * VolIncreaseRatio;
// 5. 이평선 지지
Condition5 = Low >= MA5 * (1 - MASupportRange) And Low <= MA5 * (1 + MASupportRange) Or
Low >= MA10 * (1 - MASupportRange) And Low <= MA10 * (1 + MASupportRange);
// 매수 신호
If Condition1 And Condition2 And Condition3 And Condition4 And Condition5 Then
BuyMarket(100);
End;
첨부한 이미지 파일처럼 오류 나오는데 수정좀 해주실수 있나요?
2025-06-11
281
글번호 191640
답변완료
수식문의
수고많으십니다.
1. 매진입 조건
일목균형표의 기준선과 전환선 그리고 MACD sig선 3가지의 지표가 동시에 상승
2.매수청산
위의 3가지 중 어느 하나라도 하락 전환 시 청산
3. 매도 진입과 매도 청산은 위 조건의 반대일 경우 청산
4. 그리고 예시처럼 위의 구간에 색상(강세/약세)을 넣을 수 는 없는지요?
ex) MACD 기준선 색상
input : shortPeriod(12),longPeriod(26),Period(9);
var : macdv(0),macds(0),box(0),TL(0);
macdv = macd(shortPeriod,longPeriod);
macds = Ema(macdv,Period);
if CrossUp(MACDV,0) Then
{
box = Box_New(sDate,sTime,0,NextBarSdate,NextBarStime,99999999);
Box_SetColor(box,Red);
Box_SetFill(box,true);
TL = TL_New(sDate,sTime,0,sDate,sTime,99999999);
TL_SetColor(TL,Black);
TL_SetSize(TL,0);
}
Else if CrossDown(MACDV,0) Then
{
box = Box_New(sDate,sTime,0,NextBarSdate,NextBarStime,99999999);
Box_SetColor(box,Blue);
Box_SetFill(box,true);
TL = TL_New(sDate,sTime,0,sDate,sTime,99999999);
TL_SetColor(TL,Black);
TL_SetSize(TL,0);
}
Else
Box_SetEnd(box,NextBarSdate,NextBarStime,99999999);
Plot1(macdv,"macd");
//Plot2(macds,"signal");
PlotBaseLine1(0);
미리 감사 드립니다.
2025-06-11
247
글번호 191639
답변완료
RSI 지표 강세 약세 챠트에 적용
RSI지표를 첨부된 사진 처럼 챠트에 적용해 사용하고 싶습니다.
키움 챠트 처럼 강세 약세 형식의 챠트로 만들고 싶습니다.
부탁드립니다.
2025-06-12
259
글번호 191635
답변완료
선물 청산 주문합수 선택방법
선물거래프로그램에서
저는 매수 잔고가 있을때 매도함수로 Then(Sell("매도",Onclose,def,def)) 하고있는데
현재 매수 잔고가 있으면 청산만하고 매도 진입은 안하는 방법 좀 알려주세요.
매수 추세 추종을 해야되는데 매수잔고가 없을때 매도 진입이 되는 현상이 발생합니다
2025-06-11
235
글번호 191632
답변완료
지표부탁드립니다.
1.
15분단위 세로선(흐린회색 작은점선으로) 부탁드립니다.
2. 9시 시작으로 변경 부탁드립니다.
var : cnt1(0), cnt2(0);
var : S1(0),D1(0),TM(0),TF(0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%60;
if TF >= 0 and TF < 30 Then
{
cnt2 = 0;
cnt1 = cnt1+1;
}
if TF >= 30 Then
{
cnt1 = 0;
cnt2 = cnt2+1;
}
if cnt1 == 1 or cnt2 == 1 Then
Var3 = O;
plot2(Var3);
}
2025-06-12
330
글번호 191629
답변완료
3202 질문
첨부파일 코딩은 어디서 볼수있나요?
각 섹터별 설명 가능하신가요?
아니면
전체 수익률 상위종목 이것만 설명 부탁드립니다.
2025-06-11
259
글번호 191628
답변완료
문의 드립니다
안녕하세요
inputs:
Period(10);
vars:
smaHigh(0),
smaLow(0),
Hlv(0),
sslUp(0),
sslDown(0),
prevHlv(0);
smaHigh = Average(High, Period);
smaLow = Average(Low, Period);
if Close > smaHigh then
Hlv = 1;
else if Close < smaLow then
Hlv = -1;
else
Hlv = prevHlv;
if Hlv < 0 then
begin
sslDown = smaHigh;
sslUp = smaLow;
end
else
begin
sslDown = smaLow;
sslUp = smaHigh;
end;
prevHlv = Hlv;
Plot1(sslDown, "SSL Down");
Plot2(sslUp, "SSL Up");
plot1과 plot2t선이 역전,호전될 경우 매수매도신호가 표시되고, 10틱단위로 차트에 표시되게 부탁드립니다.
감사합니다
2025-06-11
308
글번호 191627
회원 님에 의해서 삭제되었습니다.
2025-06-11
79
글번호 191626