커뮤니티

예스랭귀지 Q&A

글쓰기

[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내

안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
프로필 이미지
예스스탁
2026-02-27
1317
글번호 230811
지표
답변완료

부탁드립니다 항상 감사합니다

var : cnt(0); Array: WO , WH , WL , WC ; // 배열 크기 및 초기값 지정 // 월요일이거나 차트 시작 지점인 경우 → 새로운 주 시작 if DayOfWeek(Date) = 1 or Index = 0 then Begin WO[0] = O; // 주 시가 WH[0] = H; // 주 고가 초기화 WL[0] = L; // 주 저가 초기화 // 과거 데이터 1칸씩 이동 (최신 → 뒤로 밀기) For cnt = 49 downto 1 Begin WO[cnt] = WO[cnt - 1]; WH[cnt] = WH[cnt - 1]; WL[cnt] = WL[cnt - 1]; WC[cnt] = WC[cnt - 1]; End; End; // 주중 고가 갱신 if WH[0] > 0 and H > WH[0] then WH[0] = H; // 주중 저가 갱신 if WL[0] > 0 and L < WL[0] then WL[0] = L; // 종가는 매일 갱신 WC[0] = C; // 시각화 출력 if WO[0] > 0 then Begin Plot1(WO[0], "주봉시가"); Plot2(WH[0], "주봉고가"); Plot3(WL[0], "주봉저가"); Plot 2.Input: 표시여부(True), 박스표시(True), 선표시(True), 텍스트표시(True), 연장일수(5); Var: cnt(0), vtl(0), BoxID(0), TxtID(0); Array: WO, WH, WL, WC; If (DayOfWeek(Date) = 1 Or Index = 0) And 표시여부 Then Begin WO[0] = O; WH[0] = H; WL[0] = L; For cnt = 49 Downto 1 Begin WO[cnt] = WO[cnt - 1]; WH[cnt] = WH[cnt - 1]; WL[cnt] = WL[cnt - 1]; WC[cnt] = WC[cnt - 1]; End; End; If WH[0] > 0 And H > WH[0] Then WH[0] = H; If WL[0] > 0 And L < WL[0] Then WL[0] = L; WC[0] = C; If WO[0] > 0 And 표시여부 Then Begin If 선표시 Then Begin vtl = TL_New(Date, Time, WO[0], Date + 연장일수, WO[0]); TL_SetColor(vtl, Cyan); vtl = TL_New(Date, Time, WH[0], Date + 연장일수, WH[0]); TL_SetColor(vtl, Red); vtl = TL_New(Date, Time, WL[0], Date + 연장일수, WL[0]); TL_SetColor(vtl, Blue); vtl = TL_New(Date, Time, WC[0], Date + 연장일수, WC[0]); TL_SetColor(vtl, Yellow); End; If 박스표시 Then Begin BoxID = Box_New(Date, Time, WH[0], Date + 연장일수, WL[0]); Box_SetFillColor(BoxID, PaleGreen); End; If 텍스트표시 Then Begin TxtID = Text_New(Date, Time, WH[0] + 1, "주 고가: " + NumToStr(WH[0], 2)); Text_SetColor(TxtID, Red); End; End; 3.Input: 표시여부(True), 박스표시(True), 선표시(True), 텍스트표시(True), 연장일수(5); Var: cnt(0), vtl(0), BoxID(0), TxtID(0); Array: WO, WH, WL, WC; If (DayOfWeek(Date) = 1 Or Index = 0) And 표시여부 Then Begin WO[0] = O; WH[0] = H; WL[0] = L; For cnt = 49 Downto 1 Begin WO[cnt] = WO[cnt - 1]; WH[cnt] = WH[cnt - 1]; WL[cnt] = WL[cnt - 1]; WC[cnt] = WC[cnt - 1]; End; End; If WH[0] > 0 And H > WH[0] Then WH[0] = H; If WL[0] > 0 And L < WL[0] Then WL[0] = L; WC[0] = C; If WO[0] > 0 And 표시여부 Then Begin If 선표시 Then Begin vtl = TL_New(Date, Time, WO[0], Date + 연장일수, WO[0]); TL_SetColor(vtl, Cyan); vtl = TL_New(Date, Time, WH[0], Date + 연장일수, WH[0]); TL_SetColor(vtl, Red); vtl = TL_New(Date, Time, WL[0], Date + 연장일수, WL[0]); TL_SetColor(vtl, Blue); vtl = TL_New(Date, Time, WC[0], Date + 연장일수, WC[0]); TL_SetColor(vtl, Yellow); End; If 박스표시 Then Begin BoxID = Box_New(Date, Time, WH[0], Date + 연장일수, WL[0]); Box_SetFillColor(BoxID, PaleGreen); End; If 텍스트표시 Then Begin TxtID = Text_New(Date, Time, WH[0] + 1, "주 고가: " + NumToStr(WH[0], 2)); Text_SetColor(TxtID, Red); End; End; 오류수정 부탁드립니다
프로필 이미지
윤호석
2025-05-16
274
글번호 190860
지표
답변완료

항상 감사한 마음입니다. 지표 변환 가능할까요

// This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International // https://creativecommons.org/licenses/by-nc-sa/4.0/ // &#169; BigBeluga //@version=6 indicator('Volumatic Variable Index Dynamic Average [BigBeluga]', 'Volumatic VIDYA [BigBeluga]', overlay = true, max_lines_count = 500, max_labels_count = 500) // INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{ // Input parameters for length, momentum, and source data int vidya_length = input.int(10, 'VIDYA Length') // Length of the VIDYA calculation int vidya_momentum = input.int(20, 'VIDYA Momentum') // Momentum length for VIDYA float band_distance = input.float(2, 'Distance factor for upper/lower bands', step = 0.1) // Distance factor for upper/lower bands // Define pivot parameters int pivot_left_bars = 3 // Left side pivot bars int pivot_right_bars = pivot_left_bars // Right side pivot bars float source = input.source(close, 'Source') // Source for VIDYA calculation // Define colors for up and down trends color up_trend_color = input(#17dfad, '+', group = 'Color', inline = 'c') // Color for uptrend color down_trend_color = input(#dd326b, '-', group = 'Color', inline = 'c') // Color for downtrend bool shadow = input.bool(true, 'Shadow', group = 'Color', inline = 'c') // Initialize variables for line, volume, and trend state var line pivot_line = na // Variable for storing line references var float volume_value = na // Variable for storing volume data float smoothed_value = na // Smoothing variable for VIDYA trend levels var bool is_trend_up = false // Boolean variable for tracking trend direction // Initialize arrays for storing line and volume information var array<line> liquidity_lines_low = array.new<line>(500) // Array for storing lines for lows var array<line> liquidity_lines_high = array.new<line>(500) // Array for storing lines for highs var float up_trend_volume = na // Volume accumulated during uptrend var float down_trend_volume = na // Volume accumulated during downtrend // } // FUNCTIONS―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{ // Define VIDYA (Variable Index Dynamic Average) function vidya_calc(src, vidya_length, vidya_momentum) => float momentum = ta.change(src) float sum_pos_momentum = math.sum(momentum >= 0 ? momentum : 0.0, vidya_momentum) float sum_neg_momentum = math.sum(momentum >= 0 ? 0.0 : -momentum, vidya_momentum) float abs_cmo = math.abs(100 * (sum_pos_momentum - sum_neg_momentum) / (sum_pos_momentum + sum_neg_momentum)) float alpha = 2 / (vidya_length + 1) var float vidya_value = 0.0 vidya_value := alpha * abs_cmo / 100 * src + (1 - alpha * abs_cmo / 100) * nz(vidya_value[1]) ta.sma(vidya_value, 15) // Method to extend lines and add labels for liquidity levels method extend_liquidity_lines(array<line> line_array, float price_level, bool is_cross, volume_val) => if line_array.size() > 0 and last_bar_index - bar_index < 5000 for i = 0 to line_array.size() - 1 by 1 if i < line_array.size() line liquidity_line = line_array.get(i) float current_line_level = line.get_y2(liquidity_line) bool price_cross = is_cross ? price_level < current_line_level and price_level[1] >= current_line_level : price_level > current_line_level and price_level[1] <= current_line_level bool is_short_line = bar_index - line.get_x1(liquidity_line) < 50 if price_cross and is_short_line line.set_x2(liquidity_line, bar_index) line_array.remove(i) // Add volume label to the liquidity zone label.new(bar_index - 1, price_level[1], str.tostring(volume_val, format.volume), color = color.rgb(0, 0, 0, 99), style = is_cross ? label.style_label_lower_left : label.style_label_upper_left, textcolor = chart.fg_color, size = size.small) // Add a circle label to represent liquidity zone label.new(bar_index - 1, price_level[1], text = '&#9673;', color = #00000003, textcolor = is_cross ? down_trend_color : up_trend_color, style = label.style_label_center, size = size.normal) // } // CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{ // Calculate the Average True Range (ATR) float atr_value = ta.atr(200) // ATR calculation with length of 200 // Calculate the VIDYA (Variable Index Dynamic Average) vidya_value = vidya_calc(source, vidya_length, vidya_momentum) // Calculate upper and lower bands based on VIDYA and ATR float upper_band = vidya_value + atr_value * band_distance float lower_band = vidya_value - atr_value * band_distance // Detect trend direction using crossovers of source with bands if ta.crossover(source, upper_band) is_trend_up := true is_trend_up if ta.crossunder(source, lower_band) is_trend_up := false is_trend_up // Set trend-based smoothing variable if is_trend_up smoothed_value := lower_band smoothed_value if not is_trend_up smoothed_value := upper_band smoothed_value if ta.change(is_trend_up) smoothed_value := na smoothed_value // Calculate pivot highs and lows for price action bool pivot_high = not na(ta.pivothigh(pivot_left_bars, pivot_right_bars)) bool pivot_low = not na(ta.pivotlow(close, pivot_left_bars, pivot_right_bars)) // Create and store lines for pivot lows (support zones) if low[pivot_right_bars] > smoothed_value and pivot_low pivot_line := line.new(bar_index[pivot_right_bars], low[pivot_right_bars], bar_index[pivot_right_bars] + 5, low[pivot_right_bars], color = color.new(up_trend_color, 50)) liquidity_lines_low.push(pivot_line) volume_value := math.sum(volume, pivot_right_bars + pivot_left_bars) / (pivot_right_bars + pivot_left_bars) volume_value // Create and store lines for pivot highs (resistance zones) if high[pivot_right_bars] < smoothed_value and pivot_high pivot_line := line.new(bar_index[pivot_right_bars], high[pivot_right_bars], bar_index[pivot_right_bars] + 5, high[pivot_right_bars], color = color.new(down_trend_color, 50)) liquidity_lines_high.push(pivot_line) volume_value := math.sum(-volume, pivot_right_bars + pivot_left_bars) / (pivot_right_bars + pivot_left_bars) volume_value // Extend lines to track price movements liquidity_lines_high.extend_liquidity_lines(smoothed_value, true, volume_value) liquidity_lines_low.extend_liquidity_lines(smoothed_value, false, volume_value) // Detect changes in the trend direction bool trend_cross_up = not is_trend_up[1] and is_trend_up bool trend_cross_down = not is_trend_up and is_trend_up[1] // Reset volume counters when trend changes if ta.change(trend_cross_up) or ta.change(trend_cross_down) up_trend_volume := 0 down_trend_volume := 0 down_trend_volume // Accumulate volume during trends if not(ta.change(trend_cross_up) or ta.change(trend_cross_down)) up_trend_volume := up_trend_volume + (close > open ? volume : 0) down_trend_volume := down_trend_volume + (close < open ? volume : 0) down_trend_volume // Calculate average volume float avg_volume_delta = (up_trend_volume + down_trend_volume) / 2 // Determine the color of the trend color trend_color = is_trend_up ? up_trend_color : not is_trend_up ? down_trend_color : chart.fg_color // Calculate delta volume percentage string delta_volume = str.tostring((up_trend_volume - down_trend_volume) / avg_volume_delta * 100, format.percent) == 'NaN%' ? '0%' : str.tostring((up_trend_volume - down_trend_volume) / avg_volume_delta * 100, format.percent) // } // PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{ // Display labels for volume and trend statistics on the last bar if barstate.islast label.delete(label.new(bar_index, smoothed_value, 'Buy: ' + str.tostring(up_trend_volume, format.volume) + '₩n Sell: ' + str.tostring(down_trend_volume, format.volume) + '₩nDelta Volume: ' + delta_volume, color = color.new(trend_color, 90), style = is_trend_up ? label.style_label_upper_left : label.style_label_lower_left, textcolor = chart.fg_color)[1]) label.delete(label.new(bar_index, smoothed_value, text = '&#10026;', color = #00000003, textcolor = trend_color, style = label.style_label_center, size = size.large)[1]) // Plot the VIDYA trend line p1 = plot(smoothed_value, color = trend_color, linewidth = 2, style = plot.style_linebr) p2 = plot(hl2, display = display.none) // Fill between the plot and the VIDYA line fill(p1, p2, smoothed_value, hl2, color.new(trend_color, shadow ? 80 : 100), na) // Plot trend change markers (up and down arrows) plotshape(series = trend_cross_up[1] ? smoothed_value[0] : na, title = 'Trend Up', style = shape.labelup, location = location.absolute, color = color.new(up_trend_color, 50), text = '▲', textcolor = chart.fg_color) plotshape(series = trend_cross_down[1] ? smoothed_value[0] : na, title = 'Trend Down', style = shape.labeldown, location = location.absolute, color = color.new(down_trend_color, 50), text = '▼', textcolor = chart.fg_color) // }
프로필 이미지
갈랑교
2025-05-16
504
글번호 190859
지표
답변완료

오류

작성해주신 코드2개 전부다 차트에 적용이 되질않습니다 1. input: 기준배율(1.8), 익절비율(1.01), 손절비율(0.995), 진입선색(cyan), 익절선색(green), 손절선색(red); var: 기준거래량(0), 중심선(0), 제곱합(0), 분산(0), 표준편차(0), BB상단(0), ma5(0), ma20(0), 진입가(0), 익절선(0), 손절선(0), 신호발생(false), 매도출력(false), ID_진입선(0), ID_익절선(0), ID_손절선(0), ID_txt(0); // === 기준 계산 === 기준거래량 = ma(volume, 20); 중심선 = ma(Close, 20); 제곱합 = ma(Close * Close, 20); 분산 = 제곱합 - 중심선 * 중심선; 표준편차 = SquareRoot(분산); BB상단 = 중심선 + 표준편차 * 2; ma5 = ma(Close, 5); ma20 = ma(Close, 20); // === 매수 신호 === if (신호발생 == false) and (volume > 기준거래량 * 기준배율) and (Close > BB상단) and (Close > Open) and ((Close - Open) > (High - Low) * 0.6) and (ma5 > ma20) then begin // 기존 선 삭제 TL_Delete(ID_진입선); TL_Delete(ID_익절선); TL_Delete(ID_손절선); 진입가 = Close; 익절선 = 진입가 * 익절비율; 손절선 = 진입가 * 손절비율; // 진입선 ID_진입선 = TL_New(sdate, stime, 진입가,NextBarSdate,NextBarStime,진입가); TL_SetColor(ID_진입선, 진입선색); TL_SetSize(ID_진입선, 2); // 익절선 ID_익절선 = TL_New(sdate, stime, 익절선, NextBarSdate, NextBarStime, 익절선); TL_SetColor(ID_익절선, 익절선색); TL_SetSize(ID_익절선, 2); // 손절선 ID_손절선 = TL_New(sdate, stime, 손절선, NextBarSdate, NextBarStime, 손절선); TL_SetColor(ID_손절선, 손절선색); TL_SetSize(ID_손절선, 2); 신호발생 = true; 매도출력 = false; end; // === 매도 신호 === if (신호발생 == true) and (매도출력 == false) then begin if (Close >= 익절선) or (Close <= 손절선) then begin ID_txt = Text_New(date, time, High, "SELL"); Text_SetColor(ID_txt, red); 매도출력 = true; end; TL_SetEnd(ID_진입선,sDate,sTime,진입가); TL_SetEnd(ID_익절선,sDate,sTime,익절선); TL_SetEnd(ID_손절선,sDate,sTime,손절선); end; // === 상태 초기화 === if (매도출력 == true) and ((Close > 익절선) or (Close < 손절선)) then begin 신호발생 = false; 매도출력 = false; end; 2. Input: 기준배율(1.8), 익절비율(1.02), 손절비율(0.98); Var: 기준거래량(0), 진입가(0), 익절가(0), 손절가(0), 진입중(false), 매도완료(false), 승수(0), 총수(0), 승률(0); // --- 거래 조건 --- 기준거래량 = Average(volume, 20); If 진입중 == false and 매도완료 == false Then Begin If volume > 기준거래량 and Close > BollBandUp(20, 2) and Close > Open and (Close - Open) > (High - Low) * 0.6 Then Begin 진입가 = Close; 익절가 = 진입가 * 익절비율; 손절가 = 진입가 * 손절비율; 진입중 = true; 총수 = 총수+1; Text_New(date, time, Close, "BUY"); End; End; // --- 청산 조건 --- If 진입중 == true and 매도완료 == false Then Begin If Close >= 익절가 or Close <= 손절가 Then Begin If Close >= 익절가 Then 승수 = 승수+ 1; Text_New(date, time, Close, "SELL"); 매도완료 = true; End; End; // --- 상태 초기화 --- If 매도완료 == true and (Close > 익절가or Close < 손절가) Then Begin 진입중 = false; 매도완료 = false; End; // --- 승률 계산 --- If 총수 > 0 Then 승률 = 승수 / 총수 * 100.0; Plot1(승률, "승률");
프로필 이미지
윤호석
2025-05-16
263
글번호 190858
지표
답변완료

수식 문의드립니다.

안녕하세요 수식 문의드립니다. 이동평균선 기울기가 변할 때 화살표가 나오는데 1 부터 5 까지 이평 기울기 중에 5 개 기울기가 모두 같은 방향일 때 화살표가 나오게 부탁드립니다. 감사합니다. ^^
프로필 이미지
억수로
2025-05-16
227
글번호 190857
시스템
답변완료

종목검색 문의 드립니다

예스 지표수식 입니다 지표에서 골든 크로스 종목검색 문의드립니다 input : P(20); var1 = ma(H,P); Var2 = ma(L,P); if C > var1 Then Var3 = 1; if C < Var2 Then Var3 = -1; value1 = IFf(Var3 < 0,var1,Var2); value2 = IFf(Var3 < 0,var2,Var1); Plot1(value1,"1",Blue); plot2(Value2,"2",Red);
프로필 이미지
비리번
2025-05-15
232
글번호 190856
종목검색
답변완료

부탁드립니다.

조건식을 만들려고 하는데 aa= 직전 20봉 고가중에 고가; bb= 직전 20봉 저가중에 저가 1. 직전 10봉 안에 종가가 bb[1] 아래로 내려간적이 있다. 2. 직전 10봉 안에 종가가 aa[1] 위로 올라간적이 있다. 과거 10봉안의 종가, 그리고 그 봉에서의 aa[1],bb[1]가 달라져야될 것 같은데 그 수식작성을 모르겠습니다. 부탁드립니다.
프로필 이미지
소드노
2025-05-15
237
글번호 190855
시스템

사공하늘 님에 의해서 삭제되었습니다.

프로필 이미지
사공하늘
2025-05-15
95
글번호 190854
검색
답변완료

후행스팬 60이평 돌파

안녕하세요, 도움 감사드립니다. 키움HTS에서 지표로 사용하고 있는, 후행스팬이 지수60이평 돌파시의 신호입니다. M=shift(close,-midPeriod+1); Crossup(M,eavg(M,60,25)) 지표변수 - midperiod 26 이것을 종목검색으로 변환 부탁드립니다.
프로필 이미지
리버피닉스
2025-05-15
322
글번호 190853
종목검색
답변완료

지표 변환 부탁드립니다.

//@version=6 //----------------------------------------------------------------------------- // NeuroTrend &#8211; Adaptive AI Trend Engine // //: // NeuroTrend is an adaptive, AI-assisted trend indicator designed for momentum // and swing trading. It uses dynamic EMAs, slope forecasting, neural memory, // and a trend classification engine to deliver real-time insights. The system // includes confidence scoring, reversal detection, and a premium visual dashboard. // // Key Features: // &#8226; Adaptive EMA smoothing based on volatility and momentum conditions // &#8226; Real-time slope angle, power, and projected trend forecasts // &#8226; Neural memory system for volatility-aware threshold calibration // &#8226; Classification of trend phases: Impulse, Cooling, Reversal, Stall, Neutral // &#8226; Confidence score derived from DMI, slope, and volatility ratio // &#8226; Reversal and stall zone detection with alert labeling // &#8226; AI-style commentary with smart coaching logic // &#8226; Compact dashboard with all trend diagnostics in one view // // Usage: // Best used to time entries // into strong trend conditions, confirm trend continuation, or detect exhaustion // before reversals. // // Author: AresIQ // License: Mozilla Public License 2.0 // Terms: This open-source 스크립트 may be modified and reused with attribution. // // Link to License: https://www.mozilla.org/en-US/MPL/2.0/ //----------------------------------------------------------------------------- indicator("NeuroTrend", overlay=true) // USER INPUTS ₩₩ enableReflex = input.bool(false, "Enable Reflex Mode", inline="reflex", group="Turbo Mode") showCommentary = input.bool(true, "Show AI Commentary", inline="ai", group="Neuro Settings") tablePosition = input.string("Top Right", "Dashboard Position", options=["Top Left", "Top Middle", "Top Right", "Bottom Left", "Bottom Middle", "Bottom Right"], group="Neuro Settings") pos = tablePosition == "Top Left" ? position.top_left : tablePosition == "Top Middle" ? position.top_center : tablePosition == "Top Right" ? position.top_right : tablePosition == "Bottom Left" ? position.bottom_left : tablePosition == "Bottom Middle" ? position.bottom_center : position.bottom_right commentaryTextColor = input.color(color.white, "Commentary Text Color", inline="commentaryColor", group="Neuro Settings") tableTextColor = input.color(color.white, "Dashboard Text Color", group="Neuro Settings") baseFast = input.int(10, "Base Fast EMA") baseSlow = input.int(21, "Base Slow EMA") showConfidence = input.bool(true, "Show Confidence Score", inline="conf", group="Neuro Settings") showReversal = input.bool(true, "Show Reversal Warnings", inline="rev", group="Neuro Settings") showStall = input.bool(true, "Show Stall Alerts", inline="stall", group="Neuro Settings") showProjection = input.bool(true, "Show Slope Projection", inline="proj", group="Neuro Settings") enableAlerts = input.bool(true, "Enable Smart Alerts", inline="alerts", group="Alerts") // CUSTOM ALERT BUILDER ₩₩ customEnableAlerts = input.bool(false, "Enable Custom Alerts", group="Alerts") customMinConfidence = input.int(60, "Min Confidence", minval=0, maxval=100, group="Alerts") customRequireImpulse = input.bool(true, "Require Impulse", group="Alerts") customRequireBullish = input.bool(false, "Only Bullish Trends", group="Alerts") customRequireBearish = input.bool(false, "Only Bearish Trends", group="Alerts") customBlockReversal = input.bool(true, "Ignore Reversal Risk", group="Alerts") customBlockStall = input.bool(false, "Ignore Stall", group="Alerts") // SESSION PHASE DETECTION ₩₩ hourNow = hour(time) minuteNow = minute(time) sessionMinute = (hourNow - 9) * 60 + minuteNow - 30 // 0 at 9:30 AM sessionPhase = sessionMinute < 90 ? "&#9200; Morning Drive" : sessionMinute < 270 ? "&#128564; Midday Drift" : sessionMinute <= 390 ? "&#9889; Power Hour" : "&#9203; After Hours" // CONTEXT ₩₩ atr = ta.atr(14) rsi = ta.rsi(close, 14) volFactor = atr / close momentumFactor = (rsi - 50) / 100 // ADAPTIVE LENGTHS ₩₩ fastLen = enableReflex ? baseFast * 0.75 : baseFast - volFactor * 5 + momentumFactor * 5 slowLen = enableReflex ? baseSlow * 0.85 : baseSlow + volFactor * 5 - momentumFactor * 5 alphaFast = 2.0 / (fastLen + 1.0) alphaSlow = 2.0 / (slowLen + 1.0) // ADAPTIVE EMA FUNCTION ₩₩ adaptiveEMA(src, alpha) => var float result = na result := na(result[1]) ? src : alpha * src + (1 - alpha) * result[1] // EMAS ₩₩ emaFast = adaptiveEMA(close, alphaFast) emaSlow = adaptiveEMA(close, alphaSlow) // SLOPE METRICS ₩₩ slopeDeg = math.atan(emaFast - emaSlow) * 180 / math.pi slopePower = enableReflex ? slopeDeg * (1 + volFactor * 0.5 + momentumFactor * 1.5) : slopeDeg * (1 + volFactor + momentumFactor) glowIntensity = math.min(math.abs(slopePower), 50) // COLOR ENGINE ₩₩ baseColor = slopePower > 0 ? color.rgb(38, 230, 0) : color.rgb(168, 45, 36) // RENDER LAYERS ₩₩ glowBase = slopePower > 0 ? color.rgb(80, 255, 100) : color.rgb(255, 70, 70) coreColor = color.new(glowBase, 0) glow1 = color.new(glowBase, 75) glow2 = color.new(glowBase, 85) shadowTrail = color.new(glowBase, 92) plot(emaFast, title="Fast EMA Core", color=coreColor, linewidth=3) plot(emaFast, title="Glow Layer 1", color=glow1, linewidth=6) plot(emaFast, title="Glow Layer 2", color=glow2, linewidth=9) plot(emaSlow, title="Slow EMA", color=color.new(glowBase, 80), linewidth=2) plot(emaFast[5], title="Shadow Trail", color=shadowTrail, linewidth=1, style=plot.style_line) // FILLS ₩₩ fill(plot(emaFast), plot(emaSlow), color=color.new(glowBase, 90), title="Trend Ribbon Fill") // NEURAL MEMORY ENGINE ₩₩ atrMemory = ta.sma(atr, enableReflex ? 20 : 50) slopeStdDev = ta.stdev(slopePower, enableReflex ? 20 : 50) volatilityState = (atr / atrMemory + slopeStdDev / 30) / 2 volatilityFactor = math.min(math.max(volatilityState, 0.5), 1.5) // Auto-calibrated thresholds impulseThreshold = 40 * volatilityFactor coolingThreshold = 20 * volatilityFactor stallSlopeLimit = 10 * volatilityFactor rsiFlatMin = 48 - (5 * (volatilityFactor - 1)) rsiFlatMax = 52 + (5 * (volatilityFactor - 1)) // TREND STATE CLASSIFIER ₩₩ isImpulse = math.abs(slopePower) > impulseThreshold isCooling = math.abs(slopePower) > coolingThreshold and math.abs(slopePower) <= impulseThreshold isNeutral = math.abs(slopePower) <= 20 isReversal = ta.change(slopeDeg, 1) < -30 or ta.rsi(close, 14) < 40 trendDir = slopePower > 0 ? "Bullish" : "Bearish" // TREND AGE & DECAY ₩₩ var int trendAge = 0 trendAge := trendDir == trendDir[1] ? trendAge + 1 : 1 decayFactor = math.max(1.0 - trendAge / 100, 0.5) // Caps decay at 50% trendColor = slopePower > 0 ? color.lime : color.red phaseText = isImpulse ? "&#128293; Impulse" : isCooling ? "&#127744; Cooling" : isReversal ? "&#9888;&#65039; Reversal Risk" : "&#9940; Neutral" // PHASE MEMORY ENGINE ₩₩ var string prevPhase = na phaseChanged = not na(prevPhase) and phaseText != prevPhase prevPhase := phaseText slopeScore = math.round(math.abs(slopePower) * 2) // CONFIDENCE SCORING ENGINE ₩₩ [plusDI, minusDI, adx] = ta.dmi(14, 14) trendStrength = math.min(adx, 50) / 50 directionBias = math.abs(plusDI - minusDI) / 100 volatilityRatio = math.min(atr / math.abs(emaFast - emaSlow), 3.0) / 3.0 slopeNorm = math.min(math.abs(slopePower), 50) / 50 // CONFIDENCE SCORE ₩₩ confidenceRaw = (trendStrength + directionBias + slopeNorm + (1 - volatilityRatio)) / 4 confidenceScore = math.round(confidenceRaw * 100 * decayFactor) confidenceLabel = confidenceScore >= 75 ? "High" : confidenceScore >= 50 ? "Medium" : "Low" // REVERSAL SENSOR ENGINE ₩₩ slopeFlipping = ta.change(math.sign(slopePower)) != 0 slopeCollapsing = math.abs(slopePower) < 10 rsiDro*pping = rsi < 45 reversalRisk = (slopeFlipping and slopeCollapsing) or (rsiDro*pping and slopePower < 0) // REVERSE SYMMETRY ₩₩ isBullishReversal = reversalRisk and slopePower > 30 and close > emaFast and close > emaSlow isBearishReversal = reversalRisk and slopePower < -30 and close < emaFast and close < emaSlow isReversingNow = isBullishReversal or isBearishReversal reversalLabel = isBullishReversal ? "&#128640; Bullish Reversal" : isBearishReversal ? "&#128680; Bearish Reversal" : reversalRisk ? "&#9888;&#65039; Reversal Threat" : "&#9989; Stable" // RECOVERY DETECTION ENGINE ₩₩ wasBearish = trendDir[1] == "Bearish" emaCrossover = close > emaFast and close[1] < emaFast[1] and close > emaSlow recoveryBounce = isBullishReversal and wasBearish and emaCrossover // STALL DETECTOR ENGINE ₩₩ slopeLow = math.abs(slopePower) < stallSlopeLimit rsiFlat = rsi > rsiFlatMin and rsi < rsiFlatMax atrCompression = atr < ta.sma(atr, 20) stallDetected = rsiFlat and slopeLow and atrCompression stallLabel = stallDetected ? "&#128721; Dead Zone" : "&#9989; Active" // SLOPE PROJECTION ENGINE ₩₩ slopeNow = slopeDeg slopePrev = math.atan(emaFast[1] - emaSlow[1]) * 180 / math.pi slopeDelta = slopeNow - slopePrev slopeAccel = slopeDelta - (slopePrev - math.atan(emaFast[2] - emaSlow[2]) * 180 / math.pi) slopeForecast = slopeNow + slopeDelta + slopeAccel // ADAPTIVE SLOPE CLAMPING ENGINE ₩₩ baseClamp = 45.0 dynamicRange = 15.0 forecastVolatilityFactor = math.min(math.max((atr / ta.sma(atr, 50) + ta.stdev(slopePower, 50) / 30) / 2, 0.5), 1.5) adaptiveClamp = baseClamp + (forecastVolatilityFactor - 1.0) * dynamicRange slopeForecastClamped = math.max(math.min(slopeForecast, adaptiveClamp), -adaptiveClamp) // SLOPE PROJECTION CONFIDENCE ₩₩ slopeMomentum = math.abs(slopeAccel) forecastConfidence = slopeMomentum > 2.5 ? "High" : slopeMomentum > 1.0 ? "Medium" : "Low" projectionLabel = slopeForecastClamped > 15 ? "&#128200; Rising" : slopeForecastClamped < -15 ? "&#128201; Falling" : "&#10134; Sideways" projectionValue = " (" + str.tostring(math.round(slopeForecastClamped)) + "°, " + forecastConfidence + " Confidence)" // MOMENTUM FADING DETECTION ₩₩ slopeFading = ta.change(slopePower) < 0 and not stallDetected and not reversalRisk and math.abs(slopePower) > 15 momentumFading = slopeFading and slopePower[1] > slopePower[2] and slopePower > 10 // SMART ENTRY WINDOW DETECTION ₩₩ impulseActive = isImpulse and slopePower > 20 and confidenceScore >= 60 pulledBack = close[1] < emaFast[1] and close > emaFast and low < emaFast smartEntryWindow = impulseActive and pulledBack plotshape(smartEntryWindow, title="Smart Entry", location=location.belowbar, style=shape.triangleup, size=size.small, color=color.teal) // COMMENTARY GENERATOR ₩₩ aiCommentary = phaseChanged ? "&#128260; Phase Shift: " + prevPhase + " → " + phaseText : recoveryBounce ? "&#128257; Recovery rally &#8212; bounce reclaiming trend structure. (" + sessionPhase + ")" : smartEntryWindow ? "&#127919; Smart entry window &#8212; impulse pullback with reclaim. (" + sessionPhase + ")" : momentumFading ? "&#129707; Momentum weakening &#8212; trend may lose steam soon. (" + sessionPhase + ")" : isImpulse and confidenceScore >= 75 and not reversalRisk ? "&#128200; Strong trend forming &#8212; consider riding momentum. (" + sessionPhase + ")" : isCooling and confidenceScore >= 50 ? "&#127744; Trend slowing &#8212; caution if already in position. (" + sessionPhase + ")" : stallDetected and not isImpulse ? "&#9208;&#65039; Price stalling &#8212; this is not the time to enter. (" + sessionPhase + ")" : isBullishReversal ? "&#128640; Bullish reversal confirmed &#8212; breakout in progress. (" + sessionPhase + ")" : isBearishReversal ? "&#128680; Bearish reversal confirmed &#8212; breakdown in progress. (" + sessionPhase + ")" : reversalRisk and confidenceScore < 50 ? "&#9888;&#65039; Reversal threat building &#8212; watch for breakdown or bounce. (" + sessionPhase + ")" : confidenceScore < 30 ? "&#129514; Low conviction trend &#8212; better to wait for clarity. (" + sessionPhase + ")" : "&#10134; Trend steady &#8212; no action required right now. (" + sessionPhase + ")" var label commentaryLabel = na if showCommentary and not na(high) if not na(commentaryLabel) label.delete(commentaryLabel) commentaryLabel := showCommentary and not na(high) ? label.new(bar_index, math.max(high, high[1], high[2]) + atr * 1.5, aiCommentary, xloc.bar_index, yloc.price, style=label.style_label_center, size=size.normal, textcolor=commentaryTextColor, color=color.new(#eece89, 85), textalign=text.align_center, tooltip="NeuroTrend Commentary") : commentaryLabel // DASHBOARD RENDERING ₩₩ var table dashboard = table.new(pos, 7, 2, border_width=1, frame_color=color.new(color.white, 90), bgcolor=color.new(color.navy, 95)) if bar_index % 5 == 0 table.cell(dashboard, 0, 0, "&#129504; Phase", text_color=tableTextColor, bgcolor=color.new(color.black, 85), text_size=size.small) table.cell(dashboard, 0, 1, phaseText, text_color=tableTextColor, bgcolor=color.new(trendColor, 20), text_size=size.small) table.cell(dashboard, 1, 0, "&#128200; Direction", text_color=tableTextColor, bgcolor=color.new(color.black, 85), text_size=size.small) table.cell(dashboard, 1, 1, trendDir, text_color=tableTextColor, bgcolor=color.new(trendColor, 10), text_size=size.small) table.cell(dashboard, 2, 0, "&#128267; Slope Power", text_color=tableTextColor, bgcolor=color.new(color.black, 85), text_size=size.small) table.cell(dashboard, 2, 1, str.tostring(slopeScore) + " / 100", text_color=tableTextColor, bgcolor=color.new(trendColor, 85), text_size=size.small) if showConfidence table.cell(dashboard, 3, 0, "&#129504; Confidence", text_color=tableTextColor, bgcolor=color.new(color.black, 85), text_size=size.small) table.cell(dashboard, 3, 1, confidenceLabel + " (" + str.tostring(confidenceScore) + ")", text_color=tableTextColor, bgcolor=color.new(trendColor, 80), text_size=size.small) if showReversal table.cell(dashboard, 4, 0, "&#128680; Reversal Risk", text_color=tableTextColor, bgcolor=color.new(color.black, 85), text_size=size.small) table.cell(dashboard, 4, 1, reversalLabel, text_color=tableTextColor, bgcolor=reversalRisk ? color.new(color.red, 60) : color.new(color.green, 80), text_size=size.small) if showStall table.cell(dashboard, 5, 0, "&#9208;&#65039; Momentum", text_color=tableTextColor, bgcolor=color.new(color.black, 85), text_size=size.small) table.cell(dashboard, 5, 1, stallLabel, text_color=tableTextColor, bgcolor=stallDetected ? color.new(color.orange, 60) : color.new(color.green, 80), text_size=size.small) if showProjection table.cell(dashboard, 6, 0, "&#128225; Projection", text_color=tableTextColor, bgcolor=color.new(color.black, 85), text_size=size.small) table.cell(dashboard, 6, 1, projectionLabel + projectionValue, text_color=tableTextColor, bgcolor=color.new(trendColor, 70), text_size=size.small) // SMART ALERT CONDITION ₩₩ customAlertCondition = customEnableAlerts and confidenceScore >= customMinConfidence and (not customRequireImpulse or isImpulse) and (not customRequireBullish or slopePower > 0) and (not customRequireBearish or slopePower < 0) and (not customBlockReversal or not reversalRisk) and (not customBlockStall or not stallDetected) alertcondition(customAlertCondition, title="Custom NeuroTrend Alert", message="&#128276; NeuroTrend: Your custom alert conditions have been met.") // BUY / SELL SIGNAL LABELS ₩₩ showBuySellLabels = input.bool(true, "Show Buy/Sell Labels", group="Neuro Settings") buySignal = ta.crossover(slopeDeg, 0) and slopePower > 0 sellSignal = ta.crossunder(slopeDeg, 0) and slopePower < 0 if showBuySellLabels if buySignal label.new(bar_index, low, "BUY", style=label.style_label_up, color=color.green, textcolor=color.white, yloc=yloc.belowbar) if sellSignal label.new(bar_index, high, "SELL", style=label.style_label_down, color=color.red, textcolor=color.white, yloc=yloc.abovebar)
프로필 이미지
삼손감자
2025-05-15
1172
글번호 190852
지표