커뮤니티

수식 부탁드립니다

프로필 이미지
사노소이
2025-10-29 16:59:47
112
글번호 227462
답변완료

변환 부탁드립니다.
//@version=6 indicator("ML Prediction", overlay = true)
// === Inputs === window   = input.int(10, minval = 10, title = "ML Window") forecast = input.int(1, title = "Forecast", tooltip = "Shift the ML output forward by given bars") sigma    = input.float(0.1, step = 0.01, minval = 0, title = "Sigma") source   = input.source(close, "Source")
// === VWAP Calculation === vwap = ta.vwap(source)
// === ML Prediction Core Logic === ml_base     = ta.sma(source, window)              // Base: simple moving average ml_adjusted = ml_base + sigma * (vwap - ml_base)  // VWAP-weighted adjustment ml_output   = ml_adjusted[forecast]               // Forecast shift
// === Plotting === plot(vwap, color = color.new(color.blue, 0), title = "VWAP", linewidth = 2) plot(ml_output, color = color.new(color.orange, 0), title = "ML Prediction", linewidth = 2)

지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-10-30 12:48:53

안녕하세요 예스스탁입니다. input : window(10); input : forecast(1); input : sigma(0.1); input : source(close); var : sum1(0),sum2(0),VWAP(0); var : ml_base(0),ml_adjusted(0),ml_output(0); // === VWAP Calculation === if Bdate != Bdate[1] Then { sum1 = 0; sum2 = 0; } sum1 = sum1 + source*V; sum2 = sum2 + V; VWAP = sum1/sum2; // === ML Prediction Core Logic === ml_base = ma(source, window); ml_adjusted = ml_base + sigma * (vwap - ml_base); ml_output = ml_adjusted[forecast]; // === Plotting === plot1(vwap,"VWAP",blue); plot2(ml_output,"ML Prediction",Orange); 즐거운 하루되세요