커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

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

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

문의드립니다

20일이전에 5일선이 20일선을 하향돌파했다가 다시 상향돌파했을때 종목을 찾고싶습니다
프로필 이미지
처음처럼22
2023-11-28
1086
글번호 174383
종목검색
답변완료

종목검색식 문의드립니다

수고하십니다 종목검색식 문의드립니다 당일 5분첫봉 상승폭(저가~고가)의 두배가되는 고가라인을 종가로 돌파한 5분두번째봉의 종목을 검색하고 싶은데요.... 실시간 종목검색 가능할까요?
프로필 이미지
pinpoint
2023-11-28
1063
글번호 174382
종목검색
답변완료

시스템 변환 문의드립니다.

지표문의를 드리고 시스템 매매를 해보려고합니다. input : length(14); input : mult(1.0); var : src(0),stdev(0),Emav(0),upper(0),lower(0); var : bullish(0),bearish(0),bull_den(0),bear_den(0); var : bull(0),bear(0); src = close; stdev = std(src, length) * mult; emav = ema(src, length); upper = emav + stdev; lower = emav - stdev; bullish = AccumN(max(src - upper, 0), length); bearish = AccumN(max(lower - src, 0), length); bull_den = AccumN(abs(src - upper), length); bear_den = AccumN(abs(lower - src), length); bull = bullish/bull_den*100; bear = bearish/bear_den*100; 여기까지가 문의 답변주셔서 변환한 지표였고 위 지표를 기반으로 밑에있는 파인스크립트 코드를 변환해서 손익절을 하고싶습니다. 손익절 기준이 여러가지가 있었는데 ATR 기준으로 하고싶어서 ATR만 남기고 다 빼려고 노력했습니다만.. 여기까지가 한계라서 문의드립니다ㅜㅜ 코드에 트레일링스탑이 있는데 그것도 변환이 가능할까요? bool openLongPosition = ta.crossover(bull, bear) bool openShortPosition = ta.crossunder(bull , bear) // LOGIC ============================================================================================================ // the open signals when not already into a position bool validOpenLongPosition = openLongPosition and not (strategy.opentrades.size(strategy.opentrades - 1) > 0) bool validOpenShortPosition = openShortPosition and not (strategy.opentrades.size(strategy.opentrades - 1) < 0) bool longIsActive = validOpenLongPosition or strategy.opentrades.size(strategy.opentrades - 1) > 0 bool shortIsActive = validOpenShortPosition or strategy.opentrades.size(strategy.opentrades - 1) < 0 // INPUT ============================================================================================================ atrLength = input.int(defval = 14, title = 'ATR Length', minval = 1, tooltip = 'How many previous candles to use for the ATR calculation.', group = 'General') // LOGIC ============================================================================================================ // take profit has to communicate its exeution with the stop loss logic when 'TP' mode is seleced var bool longTrailingTakeProfitExeuted = false var bool shortTrailingTakeProfitExeuted = false float openAtr = ta.valuewhen(validOpenLongPosition or validOpenShortPosition, ta.atr(atrLength), 0) // INPUT ============================================================================================================ stopLossMethod = input.string(defval = 'ATR', title = 'Stop Loss Method', options = ['ATR'], tooltip = 'The method to calculate the Stop Loss (percentagewise, based on initial ATR or based on ATR changing over time).', group = 'Stop Loss - Target') longStopLossAtrMul = input.float(defval = 10.0, title = 'ATR Long/Short Mul', minval = 0.1, step = 0.1, inline = 'Trailing Stop Loss ATR Multiplier', group = 'Stop Loss - Target') shortStopLossAtrMul = input.float(defval = 10.0, title = '', minval = 0.1, step = 0.1, tooltip = 'ATR multiplier to be used for the long/short Stop Loss.', inline = 'Trailing Stop Loss ATR Multiplier', group = 'Stop Loss - Target') stopLossTrailingEnabled = input.string(defval = 'TP', title = 'Enable Trailing', options = ['TP', 'ON', 'OFF'], tooltip = 'Enable the trailing for Stop Loss when Take Profit order is exeted (TP) or from the start of the entry order (ON) or not at all (OFF).', group = 'Stop Loss - Trailing') breakEvenEnabled = input.bool(defval = false, title = 'Break Even', tooltip = 'When Take Profit price target is hit, move the Stop Loss to the entry price (or to a more strict price defined by the Stop Loss %/ATR Multiplier).', group = 'Stop Loss - Trailing') // LOGIC ============================================================================================================ getLongStopLossPrice(baseSrc) => switch stopLossMethod 'ATR' => baseSrc - longStopLossAtrMul * openAtr => na // trailing starts when the take profit price is reached if 'TP' mode is set or from the very begining if 'ON' mode is seleced bool longTakeProfitTrailingEnabled = stopLossTrailingEnabled == 'ON' or stopLossTrailingEnabled == 'TP' and longTrailingTakeProfitExeuted // calculate trailing stop loss price when enter long position and peserve its value until the position closes var float longStopLossPrice = na longStopLossPrice := if (longIsActive) if (validOpenLongPosition) getLongStopLossPrice(close) else stopPrice = getLongStopLossPrice(longTakeProfitTrailingEnabled ? high : strategy.opentrades.entry_price(strategy.opentrades - 1)) stopPrice := breakEvenEnabled and longTrailingTakeProfitExeuted ? math.max(stopPrice, strategy.opentrades.entry_price(strategy.opentrades - 1)) : stopPrice math.max(stopPrice, nz(longStopLossPrice[1])) else na getShortStopLossPrice(baseSrc) => switch stopLossMethod 'ATR' => baseSrc + shortStopLossAtrMul * openAtr => na // trailing starts when the take profit price is reached if 'TP' mode is set or from the very begining if 'ON' mode is seleced bool shortTakeProfitTrailingEnabled = stopLossTrailingEnabled == 'ON' or stopLossTrailingEnabled == 'TP' and shortTrailingTakeProfitExeuted // calculate trailing stop loss price when enter short position and peserve its value until the position closes var float shortStopLossPrice = na shortStopLossPrice := if (shortIsActive) if (validOpenShortPosition) getShortStopLossPrice(close) else stopPrice = getShortStopLossPrice(shortTakeProfitTrailingEnabled ? low : strategy.opentrades.entry_price(strategy.opentrades - 1)) stopPrice := breakEvenEnabled and shortTrailingTakeProfitExeuted ? math.min(stopPrice, strategy.opentrades.entry_price(strategy.opentrades - 1)) : stopPrice math.min(stopPrice, nz(shortStopLossPrice[1], 999999.9)) else na // PLOT ============================================================================================================= var stopLossColor = color.new(color.maroon, 0) plot(series = longStopLossPrice, title = 'Long Stop Loss', color = stopLossColor, linewidth = 1, style = plot.style_linebr, offset = 1) plot(series = shortStopLossPrice, title = 'Short Stop Loss', color = stopLossColor, linewidth = 1, style = plot.style_linebr, offset = 1) //#endregion ======================================================================================================== //#region TAKE PROFIT // INPUT ============================================================================================================ takeProfitQuantityPerc = input.float(defval = 50, title = 'Take Profit Quantity %', minval = 0.0, maxval = 100, step = 1.0, tooltip = 'The percentage of the position that will be withdrawn when the take profit price target is reached.', group = 'Take Profit - Quantity') takeProfitMethod = input.string(defval = 'ATR', title = 'Take Profit Method', options = ['ATR'], tooltip = 'The method to calculate the Take Profit price.', group = 'Take Profit - Target') //longTakeProfitPerc = input.float(defval = 1.0, title = 'Long/Short Take Profit %', minval = 0.05, step = 0.05, inline = 'Take Profit Perc', group = 'Take Profit - Target') / 100 //shortTakeProfitPerc = input.float(defval = 1.0, title = '', minval = 0.05, step = 0.05, tooltip = 'The percentage of the price increase/decrease to set the take profit price target for long/short positions.', inline = 'Take Profit Perc', group = 'Take Profit - Target') / 100 longTakeProfitAtrMul = input.float(defval = 10.0, title = 'ATR Long/Short Mul&#8195;', minval = 0.1, step = 0.1, inline = 'Take Profit ATR Multiplier', group = 'Take Profit - Target') shortTakeProfitAtrMul = input.float(defval = 10.0, title = '', minval = 0.1, step = 0.1, tooltip = 'ATR multiplier to be used for the long/short Take Profit.', inline = 'Take Profit ATR Multiplier', group = 'Take Profit - Target') takeProfitTrailingEnabled = input.bool(defval = true, title = 'Enable Trailing', tooltip = 'Enable or disable the trailing for take profit.', group = 'Take Profit - Trailing') distanceMethod = input.string(defval = 'ATR', title = 'Distance Method', options = ['ATR'], tooltip = 'The method to calculate the Distance for the Trailing Take Profit.', group = 'Take Profit - Trailing') distancePerc = input.float(defval = 1.0, title = 'Distance %', minval = 0.01, maxval = 100, step = 0.05, tooltip = 'The percentage wise step to be used for following the price, when the take profit target is reached.', group = 'Take Profit - Trailing') / 100 distanceAtrMul = input.float(defval = 1.0, title = 'Distance ATR Mul', minval = 0.01, step = 0.05, tooltip = 'Multiplier to be used on the initial entrys` ATR to calculate the step for following the price, when the take profit target is reached.', group = 'Take Profit - Trailing') // LOGIC ============================================================================================================ getLongTakeProfitPrice() => switch takeProfitMethod 'ATR' => close + longTakeProfitAtrMul * openAtr => na getLongTakeProfitPerc() => (close - getLongTakeProfitPrice()) / close // calculate take profit price when enter long position and peserve its value until the position closes var float longTakeProfitPrice = na longTakeProfitPrice := if (longIsActive and not longTrailingTakeProfitExeuted) if (validOpenLongPosition) getLongTakeProfitPrice() else nz(longTakeProfitPrice[1], getLongTakeProfitPrice()) else na longTrailingTakeProfitExeuted := strategy.opentrades.size(strategy.opentrades - 1) > 0 and (longTrailingTakeProfitExeuted[1] or strategy.opentrades.size(strategy.opentrades - 1) < strategy.opentrades.size(strategy.opentrades - 1)[1] or strategy.opentrades.size(strategy.opentrades - 1)[1] == 0 and high >= longTakeProfitPrice) longTrailingTakeProfitStepTicks = switch distanceMethod 'ATR' => distanceAtrMul * openAtr / syminfo.mintick => na getShortTakeProfitPrice() => switch takeProfitMethod 'ATR' => close - shortTakeProfitAtrMul * openAtr => na getShortTakeProfitPerc() => (getShortTakeProfitPrice() - close) / close // calculate take profit price when enter short position and peserve its value until the position closes var float shortTakeProfitPrice = na shortTakeProfitPrice := if (shortIsActive and not shortTrailingTakeProfitExeuted) if (validOpenShortPosition) getShortTakeProfitPrice() else nz(shortTakeProfitPrice[1], getShortTakeProfitPrice()) else na shortTrailingTakeProfitExeuted := strategy.opentrades.size(strategy.opentrades - 1) < 0 and (shortTrailingTakeProfitExeuted[1] or strategy.opentrades.size(strategy.opentrades - 1) > strategy.opentrades.size(strategy.opentrades - 1)[1] or strategy.opentrades.size(strategy.opentrades - 1)[1] == 0 and low <= shortTakeProfitPrice) shortTrailingTakeProfitStepTicks = switch distanceMethod 'ATR' => distanceAtrMul * openAtr / syminfo.mintick => na // PLOT ============================================================================================================= var takeProfitColor = color.new(color.teal, 0) plot(series = longTakeProfitPrice, title = 'Long Take Profit', color = takeProfitColor, linewidth = 1, style = plot.style_linebr, offset = 1) plot(series = shortTakeProfitPrice, title = 'Short Take Profit', color = takeProfitColor, linewidth = 1, style = plot.style_linebr, offset = 1) // LOGIC ============================================================================================================ // getting into LONG position if (validOpenLongPosition) strategy.entry(id = 'Long Entry', direction = strategy.long, alert_message = 'Long(' + syminfo.ticker + '): Start') else strategy.cancel(id = 'Long Entry') if (longIsActive) strategy.exit(id = 'Long Take Profit / Stop Loss', from_entry = 'Long Entry', qty_percent = takeProfitQuantityPerc, limit = takeProfitTrailingEnabled ? na : longTakeProfitPrice, stop = longStopLossPrice, trail_price = takeProfitTrailingEnabled ? longTakeProfitPrice : na, trail_offset = takeProfitTrailingEnabled ? longTrailingTakeProfitStepTicks : na, alert_message = 'Long(' + syminfo.ticker + '): Take Profit or Stop Loss exeuted') strategy.exit(id = 'Long Stop Loss', from_entry = 'Long Entry', stop = longStopLossPrice, alert_message = 'Long(' + syminfo.ticker + '): Stop Loss exeuted') // getting into SHORT position if (validOpenShortPosition) strategy.entry(id = 'Short Entry', direction = strategy.short, alert_message = 'Short(' + syminfo.ticker + '): Start') else strategy.cancel(id = 'Short Entry') if (shortIsActive) strategy.exit(id = 'Short Take Profit / Stop Loss', from_entry = 'Short Entry', qty_percent = takeProfitQuantityPerc, limit = takeProfitTrailingEnabled ? na : shortTakeProfitPrice, stop = shortStopLossPrice, trail_price = takeProfitTrailingEnabled ? shortTakeProfitPrice : na, trail_offset = takeProfitTrailingEnabled ? shortTrailingTakeProfitStepTicks : na, alert_message = 'Short(' + syminfo.ticker + '): Take Profit or Stop Loss exeuted') strategy.exit(id = 'Short Stop Loss', from_entry = 'Short Entry', stop = shortStopLossPrice, alert_message = 'Short(' + syminfo.ticker + '): Stop Loss exeuted') // PLOT ============================================================================================================= var posColor = color.new(color.gray, 0) plot(series = strategy.opentrades.entry_price(strategy.opentrades - 1), title = 'Position', color = posColor, linewidth = 1, style = plot.style_linebr) //#endregion ========================================================================================================
프로필 이미지
잘하고프다
2023-11-28
2889
글번호 174381
시스템
답변완료

수식 변환 부탁드립니다.

안녕하세요? 항상 감사드립니다. 아래는 K사 일봉과 분봉에 라인을 표시한 건데요 예스에서 선으로 나타내고 싶습니다. 변환가능할까요? 1. 분봉 A=PREDAYHIGH() - PREDAYLOW(); DAYOPEN()+A*0.5 2. 일봉 A=H(1)-L(1); A1=O+A*0.5; VALUEWHEN(1,CROSSUP(C,A1),A1)
프로필 이미지
매일대박
2023-11-27
1031
글번호 174380
지표

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

프로필 이미지
2wnwn
2023-11-27
19
글번호 174379
지표

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

프로필 이미지
ujkl
2023-11-27
7
글번호 174378
검색
답변완료

전환추세 고저라인 연장

Input : 전환(0.45); Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""), TL(0),TX(0); Array:고[10,4](0),저[10,4](0); var : TL1(0),TL2(0), TL3(0),TL4(0),TL5(0),TL6(0); HH = H; LL = L; If Index == 0 Then { 고[1,1] = HH; 고[1,2] = 0; 고[1,3] = sDate; 고[1,4] = sTime; 저[1,1] = LL; 저[1,2] = 0; 저[1,3] = sDate; 저[1,4] = sTime; } If Index > 0 Then { hiBar = hiBar + 1; loBar = loBar + 1; } If HH[hiBar] < HH Then hiBar = 0; If LL[loBar] > LL Then loBar = 0; Condition1 = 저[1,1]+전환 <= HH and hiBar == 0; Condition2 = 고[1,1]-전환 >= LL and loBar == 0; 처리구분 = ""; If Condition1 and Condition2 Then { If 최종꼭지점 == "저점" Then { If 저[1,1] > LL Then 처리구분 = "저점처리"; Else 처리구분 = "고점처리"; } Else If 최종꼭지점 == "고점" Then { If 고[1,1] < HH Then 처리구분 = "고점처리"; Else 처리구분 = "저점처리"; } } Else If Condition1 Then 처리구분 = "고점처리"; Else If Condition2 Then 처리구분 = "저점처리"; If 처리구분 == "고점처리" Then { If 최종꼭지점 == "저점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 고[j,jj] = 고[j-1,jj]; } } 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL,1); TL_SetColor(TL,Red); TL1 = TL_New_Self(고[1,3],고[1,4],고[1,1]+0.5,NextBarSdate,NextBarStime,고[1,1]+0.5); TL_SetSize(TL1,1); TL_SetColor(TL1,Magenta); TL3 = TL_New_Self(고[1,3],고[1,4],고[1,1]+1,NextBarSdate,NextBarStime,고[1,1]+1); TL_SetSize(TL3,1); TL_SetColor(TL3,Red); TL5 = TL_New_Self(고[1,3],고[1,4],고[1,1]+1.5,NextBarSdate,NextBarStime,고[1,1]+1.5); TL_SetSize(TL5,1); TL_SetColor(TL5,Magenta); } If 고[1,1] < HH[hiBar] Then { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL,고[1,3],고[1,4],고[1,1]); TL_SetBegin(TL1,고[1,3],고[1,4],고[1,1]+0.5); TL_SetBegin(TL3,고[1,3],고[1,4],고[1,1]+1); TL_SetBegin(TL5,고[1,3],고[1,4],고[1,1]+1.5); TL_SetEnd(TL2,고[1,3],고[1,4],저[1,1]-0.5); TL_SetEnd(TL4,고[1,3],고[1,4],저[1,1]-1); TL_SetEnd(TL6,고[1,3],고[1,4],저[1,1]-1.5); } TL_SetEnd(TL1,NextBarSdate,NextBarStime,고[1,1]+0.5); TL_SetEnd(TL3,NextBarSdate,NextBarStime,고[1,1]+1); TL_SetEnd(TL5,NextBarSdate,NextBarStime,고[1,1]+1.5); 최종꼭지점 = "고점"; Plot1(고[1,1]); NoPlot(2); } If 처리구분 == "저점처리" Then { If 최종꼭지점 == "고점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 저[j,jj] = 저[j-1,jj]; } } 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL,1); TL_SetColor(TL,Blue); TL2 = TL_New_Self(저[1,3],저[1,4],저[1,1]-0.5,NextBarSdate,NextBarStime,저[1,1]-0.5); TL_SetSize(TL2,1); TL_SetColor(TL2,Green); TL4 = TL_New_Self(저[1,3],저[1,4],저[1,1]-1,NextBarSdate,NextBarStime,저[1,1]-1); TL_SetSize(TL4,1); TL_SetColor(TL4,Blue); TL6 = TL_New_Self(저[1,3],저[1,4],저[1,1]-1.5,NextBarSdate,NextBarStime,저[1,1]-1.5); TL_SetSize(TL6,1); TL_SetColor(TL6,Green); } If 저[1,1] > LL[loBar] Then { 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL,저[1,3],저[1,4],저[1,1]); TL_SetEnd(TL1,저[1,3],저[1,4],고[1,1]+0.5); TL_SetEnd(TL3,저[1,3],저[1,4],고[1,1]+1); TL_SetEnd(TL5,저[1,3],저[1,4],고[1,1]+1.5); TL_SetBegin(TL2,저[1,3],저[1,4],저[1,1]-0.5); TL_SetBegin(TL4,저[1,3],저[1,4],저[1,1]-1); TL_SetBegin(TL6,저[1,3],저[1,4],저[1,1]-1.5); } 최종꼭지점 = "저점"; TL_SetEnd(TL2,NextBarSdate,NextBarStime,저[1,1]-0.5); TL_SetEnd(TL4,NextBarSdate,NextBarStime,저[1,1]-1); TL_SetEnd(TL6,NextBarSdate,NextBarStime,저[1,1]-1.5); Plot2(저[1,1]); NoPlot(1); } 저가라인 끝을 고점에서 다음 저점까지 연장. 고가라인은 다음 고점까지 연장. 감사합니다.
프로필 이미지
고성
2023-11-27
1059
글번호 174368
지표
답변완료

수고하십니다

1) (일) 거래대금 500 억 이상 종목을 찾고 싶습니다 2) 주가 등락률 (일) 0봉전 (중) 시가대비 0봉전 종가 등락률 10% 이상 종목을 찾고싶습니다 1. 2 따로 따로 수식 부탁 드립니다 수고하세요. 항상 감사드립니다~~
프로필 이미지
쌍둥이
2023-11-27
1067
글번호 174361
종목검색
답변완료

수식작성 부탁드립니다

아래 조건에 대한 수식을 부탁드립니다. 국내 선물 10분봉 기준 1.매수 : 분봉이 20일선 위에 있으며 macd 상승돌파시 청산 : 20일선 하락돌파 또는 macd 하락돌파시 2.매도 : 분봉이 20일선 아래 있으며 macd 하락돌파시 청산 : 20일선 상승돌파 또는 macd 상승돌파시 감사합니다.
프로필 이미지
시나리오
2023-11-27
1019
글번호 174355
시스템