커뮤니티

조건검색 문의

프로필 이미지
사공하늘
2026-02-24 17:09:48
53
글번호 230753
답변완료

//@version=5

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


// --- 설정 ---

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


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

pth = ta.highest(close, period)

var float new_pth = na

var float top_line = na


// 1. 최고가 갱신 시 값 저장

if (high > pth[1])

new_pth := high


// 2. 조건 판별

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

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


// 3. TOP 라인 확정 조건

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


if (cond)

top_line := new_pth


// 4. 상향 돌파(Long Breakout) 신호 판별

long_condition = ta.crossover(close, top_line)


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

plotshape(long_condition,

style=shape.triangleup,

location=location.belowbar,

color=color.green,

size=size.small,

title="Long Breakout Signal")


// 알림 설정

alertcondition(long_condition, title="TOP 돌파 발생", message="가격이 TOP 라인을 상향 돌파했습니다!")



당일 장중에, 분봉상에서 위 신호가 한번이라도 발생한 모든 종목을 제가 확인 할 수 있도록 검색식을 만들어주시면 감사드리겠습니다 (__)


검색
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-02-25 09:24:49

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