커뮤니티

예스랭귀지 Q&A

글쓰기

느와르 님에 의해서 삭제되었습니다.

프로필 이미지
느와르
2025-08-31
0
글번호 193614
종목검색
답변완료

종목 검색 부탁드립니다.

신=H-L; 호=MAX(C,O)-L; 조건=신/호>2 && H/C(1)>(1+15/100); valuewhen(1,조건,H); 돌파 검색식 부탁 드립니다
프로필 이미지
골든도라도
2025-08-31
86
글번호 193613
종목검색
답변완료

문의드립니다.

수고많으십니다. 제가 질문을 잘 못한거 같아 다시 문의드립니다. 연속 2양봉후 3번째 양봉에서 매수(즉, 진입봉 포함 연속 3양봉시 매수)진입후 이어서 연속 3음봉일 때 청산하는 식도 구하고 싶습니다. 즉, 3양봉이라서 매수신호가 나왔는데 바로 3음봉으로 꺽이면 청산하는 식입니다. 결국 양봉, 양봉, 양봉(매수신호 발생)후 이어서 음봉, 음봉, 음봉이 연달아 나오면 청산입니다.
프로필 이미지
카르마다
2025-08-31
57
글번호 193612
시스템
답변완료

지표작성부탁드립니다

사용지표: 볼린져밴드(20 2)와 덧붙임 지표 지표식조건 : 붙임지표의 상단선이 볼린져밴드(20) 상단선 위에 있으면 차트바탕에 노란색으로 표시되는 지표식 부탁합니다 덧붙임 : 붙임 지표식 input : period(10),multiplier(3); var : src(0), AtrV(0),upperBand(0),lowerBand(0), prevLowerBand(0), prevUpperBand(0); var : prevSuperTrend(0), direction(0),alpha(0),source(0),SuperTrend(C); if CurrentBar > 1 Then { src = (H+L)/2; alpha = 1 / period ; source = max(high - low, abs(high - close[1]), abs(low - close[1])); ATrV = alpha * source + (1 - alpha) * ATrV[1]; //지수가중이평방식 //ATrV = ma(source,AtrPeriod); //단순이평방식 upperBand = src + multiplier * AtrV; lowerBand = src - multiplier * AtrV; prevLowerBand = lowerBand[1]; prevUpperBand = upperBand[1]; if lowerBand > prevLowerBand or close[1] < prevLowerBand Then lowerBand = lowerBand; Else lowerBand = prevLowerBand; if upperBand < prevUpperBand or close[1] > prevUpperBand Then upperBand = upperBand; Else upperBand = prevUpperBand; if C > UpperBand Then direction = 1; if C < LowerBand Then direction = -1; if direction == 1 Then SuperTrend = lowerband; Else SuperTrend = upperband; Plot1(SuperTrend,"SuperTrend",IFF(direction==1,Red,Blue)); }
프로필 이미지
파워
2025-08-30
102
글번호 193611
지표
답변완료

어떻게 고쳐야 할까요?

Inputs: UseRealMBO(False), { True: 실 Bid/Ask 체결량 함수 사용, False: 업틱/다운틱 근사 } MBOLen(30), { MBO 누적 길이(분) } MBOSmooth(10), ATR_Len(14), ST_ATRMult(2.0), { SuperTrend ATR 배수 } EMA_Len(20), { 추세평균(EMA) } RSI_Len(14), CCI_Len(20), LearnRate(0.02), { 학습률 η } L2Decay(0.001), { L2 정규화 λ } ScoreThreshold(0.15), { 관망 데드존 |score|<=thr } MaxLots(3), { 최대 계약수 (미니 기준) } BaseLots(1), { 최소 계약수 } RiskATR_SL(2.0), { 고정 손절: ATR x N } RiskATR_Trail(3.0), { 트레일링: ATR x N } DayLossLimit_KRW(300000), { 1일 손실한도 } DayProfitTarget_KRW(200000), { 1일 이익목표 } PointValue(100000), { 미니선물 1pt=100,000원 } TickSize(0.05), CostPerRt_KRW(10000), { 왕복 비용(수수료+슬리피지) 가정값/계약 } UseVWAPFilter(True), UseTimeFilter(True); { 09:15~09:45, 13:30~14:30만 진입 } Vars: { --- Intraday VWAP --- } CumPV(0), CumV(0), VWAP(0), { --- MBO (업틱-다운틱 근사 or 실체결량) --- } UpV(0), DownV(0), AskV(0), BidV(0), MBO_1m(0), MBO_30(0), MBO_30_S(0), { --- SuperTrend --- } atr(0), basicU(0), basicL(0), finalU(0), finalL(0), STdir(0), { --- 기타 인디케이터 --- } ema(0), rsi(0), cci(0), { --- AI 가중치 (features 1..6) --- } w1(0), w2(0), w3(0), w4(0), w5(0), w6(0), x1(0), x2(0), x3(0), x4(0), x5(0), x6(0), score(0), action(0), { action ∈ {-1,0,1} } ret_pt(0), reward_pt(0), { --- P&L/리스크 관리 --- } DayPnL_KRW(0), LastClose(0), Lots(0), StopPx(0), TrailPx(0), canEnter(False), inTime(False), { --- 유틸 --- } i(0); /* ========= 0) 일중 리셋 ========= */ If Date <> Date[1] then begin CumPV = 0; CumV = 0; DayPnL_KRW = 0; TrailPx = 0; StopPx = 0; end; /* ========= 1) VWAP 업데이트 ========= */ atr = AvgTrueRange(ATR_Len); If CumV = 0 then begin CumPV = Close * Volume; CumV = Volume; end else begin CumPV = CumPV + Close * Volume; CumV = CumV + Volume; end; If CumV > 0 then VWAP = CumPV / CumV else VWAP = Close; /* ========= 2) SuperTrend 계산 (기본형) ========= */ basicU = (High + Low) * 0.5 + ST_ATRMult * atr; basicL = (High + Low) * 0.5 - ST_ATRMult * atr; If CurrentBar = 1 then begin finalU = basicU; finalL = basicL; STdir = 1; end else begin finalU = minlist(basicU, IFF(Close[1] > finalU[1], basicU, finalU[1])); finalL = maxlist(basicL, IFF(Close[1] < finalL[1], basicL, finalL[1])); If Close > finalU[1] then STdir = 1 else if Close < finalL[1] then STdir = -1 else STdir = STdir[1]; If STdir > 0 then finalL = maxlist(finalL, finalL[1]); If STdir < 0 then finalU = minlist(finalU, finalU[1]); end; /* ========= 3) EMA/RSI/CCI ========= */ ema = XAverage(Close, EMA_Len); rsi = RSI(RSI_Len); cci = CCI(CCI_Len); /* ========= 4) MBO (1분 단위 근사) ========= UseRealMBO = True일 때 AskV/BidV를 실 함수명으로 교체 */ If UseRealMBO then begin { 예: AskV = AskTradeVol; BidV = BidTradeVol; <-- 플랫폼 함수명으로 교체 } AskV = 0; BidV = 0; MBO_1m = AskV - BidV; end else begin If Close >= Close[1] then UpV = Volume else UpV = 0; If Close < Close[1] then DownV = Volume else DownV = 0; MBO_1m = UpV - DownV; end; MBO_30 = Summation(MBO_1m, MBOLen); MBO_30_S = Average(MBO_30, MBOSmooth); /* ========= 5) 피처 벡터 x ========= 안정화를 위해 ATR/Close 등으로 정규화하고, -3~+3으로 클리핑 */ { x1: 모멘텀(수익률/ATR) } x1 = (Close - Close[1]) / MaxList(atr, 0.00001); { x2: RSI 정규화 } x2 = (rsi - 50) / 50; { x3: CCI 정규화 } x3 = cci / 100; { x4: VWAP 위치 (상회=+, 하회=-) } x4 = (Close - VWAP) / MaxList(atr, 0.00001); { x5: 변동성 레짐 (ATR/Close) } x5 = (atr / MaxList(Close, 0.00001)); { x6: 수급(MBO 30분, 스무딩) 정규화 } x6 = MBO_30_S / MaxList(Average(Volume, MBOLen), 1); { 클리핑 } x1 = MaxList(-3, MinList(3, x1)); x2 = MaxList(-3, MinList(3, x2)); x3 = MaxList(-3, MinList(3, x3)); x4 = MaxList(-3, MinList(3, x4)); x5 = MaxList(-3, MinList(3, x5)); x6 = MaxList(-3, MinList(3, x6)); /* ========= 6) 정책 점수 score = w·x ========= */ score = w1*x1 + w2*x2 + w3*x3 + w4*x4 + w5*x5 + w6*x6; /* ========= 7) 시간대 필터 ========= */ inTime = True; If UseTimeFilter then begin inTime = (Time >= 0950 ; end; /* ========= 8) 액션 선택 (롱/숏/관망) ========= */ action = 0; If inTime then begin If score > ScoreThreshold then action = 1; If score < -ScoreThreshold then action = -1; end; /* ========= 9) 포지션 사이징 (간단 켈리풍; 변동성 억제) ========= */ Lots = BaseLots; If atr > 0 then begin { 위험회피: 변동성 높을수록 수량 축소 } Lots = BaseLots + IFF(atr/Close < 0.007, 1, 0); { 대략 0.7% 미만이면 +1 } Lots = MinList(Lots, MaxLots); end; /* ========= 10) 1일 손익 한도 체크 ========= */ { 직전 바 대비 손익 업데이트 (보유 포지션 기반) } If MarketPosition = 1 then DayPnL_KRW = DayPnL_KRW + (Close - Close[1]) * PointValue * CurrentContracts else if MarketPosition = -1 then DayPnL_KRW = DayPnL_KRW + (Close[1] - Close) * PointValue * CurrentContracts; canEnter = (DayPnL_KRW > -DayLossLimit_KRW) and (DayPnL_KRW < DayProfitTarget_KRW); /* ========= 11) 진입/청산 로직 ========= */ { 신호와 반대 포지션 보유 시 우선 청산 } If MarketPosition = 1 and action <= 0 then Sell ("ExitLongSig") all contracts next bar at market; If MarketPosition = -1 and action >= 0 then BuyToCover ("ExitShortSig") all contracts next bar at market; { 신규 진입 (한 방향만) } If canEnter then begin If MarketPosition <> 1 and action = 1 then begin If (not UseVWAPFilter) or (Close > VWAP) then Buy ("AI-Long") Lots contracts next bar at market; end; If MarketPosition <> -1 and action = -1 then begin If (not UseVWAPFilter) or (Close < VWAP) then SellShort ("AI-Short") Lots contracts next bar at market; end; end; /* ========= 12) 리스크 관리: ATR 손절 + 트레일링 ========= */ If MarketPosition = 1 then begin StopPx = EntryPrice - RiskATR_SL * atr; TrailPx = MaxList(TrailPx, Close - RiskATR_Trail * atr); If Low <= StopPx then Sell ("SL-L") all contracts next bar at market else if Low <= TrailPx then Sell ("TR-L") all contracts next bar at market; end; If MarketPosition = -1 then begin StopPx = EntryPrice + RiskATR_SL * atr; TrailPx = MinList(TrailPx, Close + RiskATR_Trail * atr); If High >= StopPx then BuyToCover ("SL-S") all contracts next bar at market else if High >= TrailPx then BuyToCover ("TR-S") all contracts next bar at market; end; /* ========= 13) 보상 계산(온라인 학습) ========= - 포지션 방향 × (당일 한 바 수익) [포인트 단위] - 비용 차감(왕복비용을 바 단위로 균등 가정 - 근사) */ ret_pt = (Close - Close[1]); { 해당 바의 포인트 변화 } If MarketPosition = 1 then reward_pt = ret_pt else if MarketPosition = -1 then reward_pt = -ret_pt else reward_pt = 0; { 비용 근사: 포지션 있을 때만 소폭 차감 } If MarketPosition <> 0 then reward_pt = reward_pt - (CostPerRt_KRW/PointValue) * 0.05; /* ========= 14) 가중치 업데이트: w <- (1-λ)w + η * reward * x ========= */ w1 = (1 - L2Decay) * w1 + LearnRate * reward_pt * x1; w2 = (1 - L2Decay) * w2 + LearnRate * reward_pt * x2; w3 = (1 - L2Decay) * w3 + LearnRate * reward_pt * x3; w4 = (1 - L2Decay) * w4 + LearnRate * reward_pt * x4; w5 = (1 - L2Decay) * w5 + LearnRate * reward_pt * x5; w6 = (1 - L2Decay) * w6 + LearnRate * reward_pt * x6; 예스시스템 언어로 어떻게 고쳐야 할까요?
프로필 이미지
드림365
2025-08-30
85
글번호 193610
시스템
답변완료

부틱드립니다

수고하십니다 키움수식을 예스로 부탁드립니다 수식1 x=sum(c*v); z=valuewhen(1,date != date(1) , x(1)); x1=sum(v); z1=valuewhen(1,date != date(1) , x(1)); (x-z)/(x1-z1) 수식2 x=sum(((h+l+c)/3)*v); z=valuewhen(1,date != date(1) , x(1)); x1=sum(v); z1=valuewhen(1,date != date(1) , x(1)); (x-z)/(x1-z1)
프로필 이미지
파생돌이
2025-08-30
70
글번호 193609
지표

드림365 님에 의해서 삭제되었습니다.

프로필 이미지
드림365
2025-08-30
0
글번호 193608
시스템
답변완료

키움수식 종목검색 부탁드립니다.

CC=CCi(20); M=Macd(12,26); Ms=eavg(M,9); S=SuperTrend(60,2); R=RSI(14); bs_C=Barssince(CC<-100); bs_M=Barssince(M<0 && CrossUp(M,Ms)); bs_S=Barssince(CrossUp(C,S)); bs_R=Barssince(R<30); 조건= bs_C=최소 && bs_C <=봉C && bs_M=최소 && bs_M <=봉M && bs_S=최소 && bs_S <=봉S && bs_R=최소 && bs_R <=봉R; 조건 && !조건(1) 지표변수 봉C 10 봉M 10 봉R 10 봉S 10 최소 5
프로필 이미지
navy
2025-08-30
79
글번호 193607
종목검색
답변완료

다음의 지표를 변환하여 주시기를 부탁드립니다.

트레이딩뷰의 "Squeeze Index [LuxAlgo]" 지표입니다. 횡보구간을 잡으려고 여러가지 지표를 사용해 보았으나 소귀의 목적을 이루지는 못했습니다. 스퀴즈 부분을 어느정도 잡을 수 있는 지표라고 하니 꼭 변환을 해 주시면 고맘겠습니다. 우선 자동매매에 적용을 하려고 하니 시스템에 맞게 부탁을 드리고 부차적으로 수동매매시 참고할 수 있도록 지표에 적용될 수 있도록 지표로도 부탁드립니다. // This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // &#169; LuxAlgo //@version=5 indicator("Squeeze Index [LuxAlgo]", "Squeeze Index [LuxAlgo]") //------------------------------------------------------------------------------ //Settings //-----------------------------------------------------------------------------{ conv = input(50, 'Convergence Factor') length = input(20) src = input(close) //Style col_0 = input(#ffeb3b, 'Gradient' , inline = 'inline0' , group = 'Style') col_1 = input(#ff5d00, '' , inline = 'inline0' , group = 'Style') col_2 = input(#ff1100, '' , inline = 'inline0' , group = 'Style') //-----------------------------------------------------------------------------} //Squeeze index //-----------------------------------------------------------------------------{ var max = 0. var min = 0. max := nz(math.max(src, max - (max - src) / conv), src) min := nz(math.min(src, min + (src - min) / conv), src) diff = math.log(max - min) psi = -50 * ta.correlation(diff, bar_index, length) + 50 //-----------------------------------------------------------------------------} //Plots //-----------------------------------------------------------------------------{ css1 = color.from_gradient(psi, 0, 80, col_0, col_1) css2 = color.from_gradient(psi, 80, 100, css1, col_2) plot_0 = plot(psi, 'PSI', psi > 80 ? na : css2) plot(psi, 'Dots', psi > 80 ? css2 : na, style = plot.style_cross) plot_1 = plot(80, display = display.none, editable = false) fill(plot_0, plot_1, psi < 80 ? na : color.new(#ff1100, 80)) hline(80) //-----------------------------------------------------------------------------}
프로필 이미지
하날랑
2025-08-30
95
글번호 193606
시스템

2wnwn 님에 의해서 삭제되었습니다.

프로필 이미지
2wnwn
2025-08-30
37
글번호 193605
지표