OPEN-SOURCE SCRIPT
조건 검색식

//version=5
indicator("조건 검색식", overlay=true)
// ----------------------
// 기본 입력
// ----------------------
shortEmaLen = input.int(112, "단기 EMA")
midEmaLen = input.int(224, "중기 EMA")
longEmaLen = input.int(448, "장기 EMA")
ema5Len = input.int(5, "EMA 5")
ema20Len = input.int(20, "EMA 20")
bbLen = input.int(20, "볼린저 기간")
bbMult = input.float(2.0, "볼린저 배수")
// ----------------------
// 이동평균선
// ----------------------
emaShort = ta.ema(close, shortEmaLen)
emaMid = ta.ema(close, midEmaLen)
emaLong = ta.ema(close, longEmaLen)
ema5 = ta.ema(close, ema5Len)
ema20 = ta.ema(close, ema20Len)
// ----------------------
// 거래량 / 거래대금
// ----------------------
avgVol = ta.sma(volume, 5)
cond_vol = (volume >= 50000 and volume <= 99999999)
cond_val = (avgVol * close >= 50000 and avgVol * close <= 9999999)
// ----------------------
// 캔들 비교
// ----------------------
cond_price = (close[1] < close) // 1봉전 종가 < 현재 종가
// ----------------------
// 이평 조건
// ----------------------
cond_ma_reverse = (emaShort < emaMid and emaMid < emaLong) // 역배열
cond_ma_short = (ema5 > ema20 and ema5[1] > ema20[1]) // 1봉 이상 지속
// ----------------------
// 체결강도 (추정치, 거래량 기준)
// ----------------------
// 체결강도 공식은 증권사마다 다르므로 근사치로 가정: (상승 거래량 비중/총거래량)
// TradingView에서 직접적인 "체결강도"는 제공하지 않음 → 임시로 100% 충족으로 세팅
cond_strength = true // 혹은 커스텀 계산 가능
// ----------------------
// 볼린저밴드 조건
// ----------------------
basis = ta.sma(close, bbLen)
dev = ta.stdev(close, bbLen)
bbUpper = basis + bbMult * dev
// 종가가 상단선 -5% ~ +5% 이내
cond_bb = (close >= bbUpper * 0.95 and close <= bbUpper * 1.05)
// ----------------------
// 일목균형표 (9,26,52)
// ----------------------
conversion = (ta.highest(high,9) + ta.lowest(low,9)) / 2
base = (ta.highest(high,26) + ta.lowest(low,26)) / 2
span1 = (conversion + base) / 2
span2 = (ta.highest(high,52) + ta.lowest(low,52)) / 2
cond_ichimoku = (close > span1 and close > span2)
// ----------------------
// 최종 조건
// ----------------------
condition = cond_vol and cond_val and cond_price and cond_ma_reverse and cond_ma_short and cond_strength and cond_bb and cond_ichimoku
plotshape(condition, title="조건 충족", style=shape.labelup, color=color.green, size=size.small, text="조건OK")
indicator("조건 검색식", overlay=true)
// ----------------------
// 기본 입력
// ----------------------
shortEmaLen = input.int(112, "단기 EMA")
midEmaLen = input.int(224, "중기 EMA")
longEmaLen = input.int(448, "장기 EMA")
ema5Len = input.int(5, "EMA 5")
ema20Len = input.int(20, "EMA 20")
bbLen = input.int(20, "볼린저 기간")
bbMult = input.float(2.0, "볼린저 배수")
// ----------------------
// 이동평균선
// ----------------------
emaShort = ta.ema(close, shortEmaLen)
emaMid = ta.ema(close, midEmaLen)
emaLong = ta.ema(close, longEmaLen)
ema5 = ta.ema(close, ema5Len)
ema20 = ta.ema(close, ema20Len)
// ----------------------
// 거래량 / 거래대금
// ----------------------
avgVol = ta.sma(volume, 5)
cond_vol = (volume >= 50000 and volume <= 99999999)
cond_val = (avgVol * close >= 50000 and avgVol * close <= 9999999)
// ----------------------
// 캔들 비교
// ----------------------
cond_price = (close[1] < close) // 1봉전 종가 < 현재 종가
// ----------------------
// 이평 조건
// ----------------------
cond_ma_reverse = (emaShort < emaMid and emaMid < emaLong) // 역배열
cond_ma_short = (ema5 > ema20 and ema5[1] > ema20[1]) // 1봉 이상 지속
// ----------------------
// 체결강도 (추정치, 거래량 기준)
// ----------------------
// 체결강도 공식은 증권사마다 다르므로 근사치로 가정: (상승 거래량 비중/총거래량)
// TradingView에서 직접적인 "체결강도"는 제공하지 않음 → 임시로 100% 충족으로 세팅
cond_strength = true // 혹은 커스텀 계산 가능
// ----------------------
// 볼린저밴드 조건
// ----------------------
basis = ta.sma(close, bbLen)
dev = ta.stdev(close, bbLen)
bbUpper = basis + bbMult * dev
// 종가가 상단선 -5% ~ +5% 이내
cond_bb = (close >= bbUpper * 0.95 and close <= bbUpper * 1.05)
// ----------------------
// 일목균형표 (9,26,52)
// ----------------------
conversion = (ta.highest(high,9) + ta.lowest(low,9)) / 2
base = (ta.highest(high,26) + ta.lowest(low,26)) / 2
span1 = (conversion + base) / 2
span2 = (ta.highest(high,52) + ta.lowest(low,52)) / 2
cond_ichimoku = (close > span1 and close > span2)
// ----------------------
// 최종 조건
// ----------------------
condition = cond_vol and cond_val and cond_price and cond_ma_reverse and cond_ma_short and cond_strength and cond_bb and cond_ichimoku
plotshape(condition, title="조건 충족", style=shape.labelup, color=color.green, size=size.small, text="조건OK")
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.