커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

수정 부탁드립니다.

안녕하세요? 아래 수식을 참조데이터2 기본차트에 넣으려고 합니다. 수식을 그에 맞게 고쳐주시면 대단히 감사하겠습니다. 감사드리며 오늘도 좋은시간 되세요. =============== input : R1(255),G1(0),B1(0); input : R2(0),G2(0),B2(255); var : hh(0),ll(0),Rt1(0),Rt2(0),Mv1(0),Mv2(0),Diff(0); Rt1 = Upvol/Volume*100; Rt2 = Downvol/Volume*100; Mv1 = money*(Rt1/100); Mv2 = money*(Rt2/100); diff = Mv1-Mv2; if Bdate != Bdate[1] Then { var1 = 0; Var2 = Diff; } var1 = var1 + Diff; if CurrentDate == sDate Then Plot1(var1,"당일실매수거래량",iff(var1 > 0,RGB(0,0,0),RGB(0,0,0))); if CurrentDate == sDate Then plot2(Var2,"첫봉종가"); if Bdate != Bdate[1] Then { hh = var1; ll = var1; } Else { if var1 > hh Then hh = var1; if var1 < ll Then ll = var1; } if CurrentDate == sDate Then { Plot3(hh,"최고"); plot4(ll,"최저"); plot5(ll+(hh-ll)*0.25,"25.0%"); plot6(ll+(hh-ll)*0.382,"38.2%"); plot7(ll+(hh-ll)*0.500,"50.0%"); plot8(ll+(hh-ll)*0.618,"61.8%"); plot9(ll+(hh-ll)*0.75,"75.0%"); plot10(ll+(hh-ll)*0.500+150,"+150"); plot11(Var2+100,"첫봉종가+20"); } if CurrentDate == sDate Then { PlotBaseLine1(0); PlotBaseLine2(30000); PlotBaseLine3(-30000); }
프로필 이미지
포보스
2023-11-28
814
글번호 174389
지표
답변완료

매수 조건식 부탁 드립니다.

안녕하세요. 아래 매수 조건들이 모두 and 상황에서 시장가 매매 가능하도록 부탁 드립니다. 매수 조건 1. 60분봉상 240이평선이 480이평선 아래 있을때 2. RSI 30 하향 돌파 시 3. 볼린저밴드 하단 하향 돌파 시 감사합니다.
프로필 이미지
둥둥애비
2023-11-28
981
글번호 174388
시스템
답변완료

문의 드립니다.

Hsto S=stochasticsSlow(s기간1, s기간2); HighestSince(1, CrossUp(S, 기준1), ma(c, 이평기간)); Lsto S=stochasticsSlow(s기간1, s기간2); LowestSince(1, CrossDown(S, 기준2), ma(c, 이평기간)); s기간1 20 s기간2 30 이평기간 10 기준1 80 기준2 20 키움 지표인데 예스로 좀 변환해주세요
프로필 이미지
신대륙발견
2023-11-28
1008
글번호 174387
지표
답변완료

문의드립니다

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

종목검색식 문의드립니다

수고하십니다 종목검색식 문의드립니다 당일 5분첫봉 상승폭(저가~고가)의 두배가되는 고가라인을 종가로 돌파한 5분두번째봉의 종목을 검색하고 싶은데요.... 실시간 종목검색 가능할까요?
프로필 이미지
pinpoint
2023-11-28
939
글번호 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
1994
글번호 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
901
글번호 174380
지표

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

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

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

프로필 이미지
전진
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
917
글번호 174368
지표