커뮤니티

조건검색 문의

프로필 이미지
사공하늘
2026-02-24 17:14:19
58
글번호 230754
답변완료

//@version=5

indicator("BTM Long Breakout Only", overlay=true)


// --- 설정 ---

period = input.int(200, title="Period")


// --- 핵심 로직 ---

ptl = ta.lowest(close, period)

pth = ta.highest(close, period)


// bars_since_break 및 continuous_new_pth 계산 (라인 확정 조건용)

continuous_new_pth = ta.highest(high, period - 2) < ta.highest(high, period - 1)

bars_since_break = ta.barssince(high > pth[1])


var float btm_line = na


// 라인 확정 조건 (기존 로직 유지)

cond = (bars_since_break == (period - 2)) and continuous_new_pth


if (cond)

btm_line := ptl


// --- 돌파 신호 로직 ---

// BTM 라인을 현재 종가가 상향 돌파(crossover)할 때 Long 신호 발생

long_breakout_btm = ta.crossover(close, btm_line)


// --- 시각화 (신호만 표시) ---

plotshape(long_breakout_btm,

style=shape.triangleup,

location=location.belowbar,

color=color.green,

size=size.small,

title="BTM Long Breakout")


// 알림 설정

alertcondition(long_breakout_btm, title="BTM 상향 돌파", message="가격이 BTM 라인을 상향 돌파했습니다!")



당일 장중 분봉상에서 위 신호가 한번이라도 ㄱ발생한 종목에 대해서 모두 확인할 수 있도록 검색식 부탁드리겠습니다 (__)

검색
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-02-25 09:43:16

안녕하세요 예스스탁입니다. input : period(200); var : ptl(0),pth(0); var : continuous_new_pth(False),bars_since_break(Nan); var : btm_line(Nan),cond(False),long_breakout_btm(False),count(0); ptl = lowest(close, period); pth = highest(close, period); continuous_new_pth = highest(high, period - 2) < highest(high, period - 1); if high > pth[1] Then bars_since_break = 0; Else bars_since_break = bars_since_break + 1; cond = (bars_since_break == (period - 2)) and continuous_new_pth; if (cond) Then btm_line = ptl; long_breakout_btm = CrossUp(close, btm_line); if sDate != sDate[1] Then count = 0; if long_breakout_btm Then count = count+1; if count > 0 Then Find(1); 즐거운 하루되세요