커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
5556
글번호 230811
아침 님에 의해서 삭제되었습니다.
2023-03-29
124
글번호 167681
답변완료
현재봉의 지표값이 0보다 큰 종목을 검색하려면?
1. "전략실행차트" 주봉에서
data1은 코스피종목
data2은 코스피지수으로 표시하였습니다.
2. "사용자함수"에 'MansfiedRS'라는 이름으로 Mansfied 상대강도 값을 구하는 함수를 만들었습니다.
input : N(numeric);
var : RSD(0),MAV(0),MRS(0);
RSD = Data1(c)/data2(c) * 100;
mav = Data1(ma(RSD,N));
MRS = ((RSD /mav) - 1 ) * 100;
MansfieldRS = MRS;
3. "지표"에서 'Mansfied 상대강도_52'라고 만들었습니다.
Plot1(MansfieldRS(52)); //52주 맨스필드상대강도 값
plot2(0); //기준선 0선 표시
4. "전략실행차트" 주봉에서 'Mansfied 상대강도_52' 지표 표시 했습니다.(첨부파일1)
data1은 코스피종목
data2은 코스피지수
'Mansfied 상대강도_52' // 52주 맨스필드상대강도 표시
5. "종목검색"에서 현재봉에서 맨스필드상대강도값이 0보다 큰 종목을 검색하고 싶어서
'#0스탠와인스타인)0'을 작성했습니다.
var1 = MansfieldRS(52);
if var1 > 0 Then
Find(1);
6."[5201]종목검색" 화면에서 '#0스탠와인스타인)0'검색식을 선택하고 검색실행했습니다.(첨부파일2)
검색되는 종목이 없습니다.
현재봉에서 맨스필드상대강도값이 0보다 큰 종목을 검색하고 싶습니다.
어디가 잘못되었는지요?
2023-03-29
1775
글번호 167680
답변완료
수식작성 부탁드립니다.
안녕하세요. 운영자님
아래와 같은 트레이딩뷰 수식을 예스트레이더 수식으로 변환 부탁드립니다.
감사합니다.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © loxx
//@version=5
indicator("STD-Filtered, N-Pole Gaussian Filter [Loxx]",
shorttitle="STDFNPGF [Loxx]",
overlay = true)
import loxx/loxxexpandedsourcetypes/4
greencolor = #2DD204
redcolor = #D2042D
//factorial calc
fact(int n)=>
float a = 1
for i = 1 to n
a *= i
a
//alpha calc
_alpha(int period, int poles)=>
w = 2.0 * math.pi / period
float b = (1.0 - math.cos(w)) / (math.pow(1.414, 2.0 / poles) - 1.0)
float a = - b + math.sqrt(b * b + 2.0 * b)
a
//n-pole calc
_makeCoeffs(simple int period, simple int order)=>
coeffs = matrix.new<float>(order + 1, 3, 0.)
float a = _alpha(period, order)
for r = 0 to order
out = nz(fact(order) / (fact(order - r) * fact(r)), 1)
matrix.set(coeffs, r, 0, out)
matrix.set(coeffs, r, 1, math.pow(a, r))
matrix.set(coeffs, r, 2, math.pow(1.0 - a, r))
coeffs
//n-pole calc
_npolegf(float src, simple int period, simple int order)=>
var coeffs = _makeCoeffs(period, order)
float filt = src * matrix.get(coeffs, order, 1)
int sign = 1
for r = 1 to order
filt += sign * matrix.get(coeffs, r, 0) * matrix.get(coeffs, r, 2) * nz(filt[r])
sign *= -1
filt
//std filter
_filt(float src, int len, float filter)=>
float price = src
float filtdev = filter * ta.stdev(src, len)
price := math.abs(price - nz(price[1])) < filtdev ? nz(price[1]) : price
price
smthtype = input.string("Kaufman", "Heiken-Ashi Better Smoothing", options = ["AMA", "T3", "Kaufman"], group= "Source Settings")
srcoption = input.string("Close", "Source", group= "Source Settings",
options =
["Close", "Open", "High", "Low", "Median", "Typical", "Weighted", "Average", "Average Median Body", "Trend Biased", "Trend Biased (Extreme)",
"HA Close", "HA Open", "HA High", "HA Low", "HA Median", "HA Typical", "HA Weighted", "HA Average", "HA Average Median Body", "HA Trend Biased", "HA Trend Biased (Extreme)",
"HAB Close", "HAB Open", "HAB High", "HAB Low", "HAB Median", "HAB Typical", "HAB Weighted", "HAB Average", "HAB Average Median Body", "HAB Trend Biased", "HAB Trend Biased (Extreme)"])
period = input.int(25,'Period', group = "Basic Settings")
order = input.int(5,'Order', group = "Basic Settings", minval = 1)
filterop = input.string("Gaussian Filter", "Filter Options", options = ["Price", "Gaussian Filter", "Both", "None"], group= "Filter Settings")
filter = input.float(1, "Filter Devaitions", minval = 0, group= "Filter Settings")
filterperiod = input.int(10, "Filter Period", minval = 0, group= "Filter Settings")
colorbars = input.bool(true, "Color bars?", group = "UI Options")
showSigs = input.bool(true, "Show signals?", group= "UI Options")
kfl=input.float(0.666, title="* Kaufman's Adaptive MA (KAMA) Only - Fast End", group = "Moving Average Inputs")
ksl=input.float(0.0645, title="* Kaufman's Adaptive MA (KAMA) Only - Slow End", group = "Moving Average Inputs")
amafl = input.int(2, title="* Adaptive Moving Average (AMA) Only - Fast", group = "Moving Average Inputs")
amasl = input.int(30, title="* Adaptive Moving Average (AMA) Only - Slow", group = "Moving Average Inputs")
[haclose, haopen, hahigh, halow, hamedian, hatypical, haweighted, haaverage] = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, [close, open, high, low, hl2, hlc3, hlcc4, ohlc4])
float src = switch srcoption
"Close" => loxxexpandedsourcetypes.rclose()
"Open" => loxxexpandedsourcetypes.ropen()
"High" => loxxexpandedsourcetypes.rhigh()
"Low" => loxxexpandedsourcetypes.rlow()
"Median" => loxxexpandedsourcetypes.rmedian()
"Typical" => loxxexpandedsourcetypes.rtypical()
"Weighted" => loxxexpandedsourcetypes.rweighted()
"Average" => loxxexpandedsourcetypes.raverage()
"Average Median Body" => loxxexpandedsourcetypes.ravemedbody()
"Trend Biased" => loxxexpandedsourcetypes.rtrendb()
"Trend Biased (Extreme)" => loxxexpandedsourcetypes.rtrendbext()
"HA Close" => loxxexpandedsourcetypes.haclose(haclose)
"HA Open" => loxxexpandedsourcetypes.haopen(haopen)
"HA High" => loxxexpandedsourcetypes.hahigh(hahigh)
"HA Low" => loxxexpandedsourcetypes.halow(halow)
"HA Median" => loxxexpandedsourcetypes.hamedian(hamedian)
"HA Typical" => loxxexpandedsourcetypes.hatypical(hatypical)
"HA Weighted" => loxxexpandedsourcetypes.haweighted(haweighted)
"HA Average" => loxxexpandedsourcetypes.haaverage(haaverage)
"HA Average Median Body" => loxxexpandedsourcetypes.haavemedbody(haclose, haopen)
"HA Trend Biased" => loxxexpandedsourcetypes.hatrendb(haclose, haopen, hahigh, halow)
"HA Trend Biased (Extreme)" => loxxexpandedsourcetypes.hatrendbext(haclose, haopen, hahigh, halow)
"HAB Close" => loxxexpandedsourcetypes.habclose(smthtype, amafl, amasl, kfl, ksl)
"HAB Open" => loxxexpandedsourcetypes.habopen(smthtype, amafl, amasl, kfl, ksl)
"HAB High" => loxxexpandedsourcetypes.habhigh(smthtype, amafl, amasl, kfl, ksl)
"HAB Low" => loxxexpandedsourcetypes.hablow(smthtype, amafl, amasl, kfl, ksl)
"HAB Median" => loxxexpandedsourcetypes.habmedian(smthtype, amafl, amasl, kfl, ksl)
"HAB Typical" => loxxexpandedsourcetypes.habtypical(smthtype, amafl, amasl, kfl, ksl)
"HAB Weighted" => loxxexpandedsourcetypes.habweighted(smthtype, amafl, amasl, kfl, ksl)
"HAB Average" => loxxexpandedsourcetypes.habaverage(smthtype, amafl, amasl, kfl, ksl)
"HAB Average Median Body" => loxxexpandedsourcetypes.habavemedbody(smthtype, amafl, amasl, kfl, ksl)
"HAB Trend Biased" => loxxexpandedsourcetypes.habtrendb(smthtype, amafl, amasl, kfl, ksl)
"HAB Trend Biased (Extreme)" => loxxexpandedsourcetypes.habtrendbext(smthtype, amafl, amasl, kfl, ksl)
=> haclose
src := filterop == "Both" or filterop == "Price" and filter > 0 ? _filt(src, filterperiod, filter) : src
out = _npolegf(src, period, order)
out := filterop == "Both" or filterop == "Gaussian Filter" and filter > 0 ? _filt(out, filterperiod, filter) : out
sig = nz(out[1])
state = 0
if (out > sig)
state := 1
if (out < sig)
state := -1
pregoLong = out > sig and (nz(out[1]) < nz(sig[1]) or nz(out[1]) == nz(sig[1]))
pregoShort = out < sig and (nz(out[1]) > nz(sig[1]) or nz(out[1]) == nz(sig[1]))
contsw = 0
contsw := nz(contsw[1])
contsw := pregoLong ? 1 : pregoShort ? -1 : nz(contsw[1])
goLong = pregoLong and nz(contsw[1]) == -1
goShort = pregoShort and nz(contsw[1]) == 1
var color colorout = na
colorout := state == -1 ? redcolor : state == 1 ? greencolor : nz(colorout[1])
plot(out, "N-Pole GF", color = colorout, linewidth = 3)
barcolor(colorbars ? colorout : na)
plotshape(showSigs and goLong, title = "Long", color = color.yellow, textcolor = color.yellow, text = "L", style = shape.triangleup, location = location.belowbar, size = size.tiny)
plotshape(showSigs and goShort, title = "Short", color = color.fuchsia, textcolor = color.fuchsia, text = "S", style = shape.triangledown, location = location.abovebar, size = size.tiny)
alertcondition(goLong, title = "Long", message = "STD-Filtered, N-Pole Gaussian Filter [Loxx]: Long₩nSymbol: {{ticker}}₩nPrice: {{close}}")
alertcondition(goShort, title = "Short", message = "STD-Filtered, N-Pole Gaussian Filter [Loxx]: Short₩nSymbol: {{ticker}}₩nPrice: {{close}}")
2023-03-29
2181
글번호 167679
아침 님에 의해서 삭제되었습니다.
2023-03-29
126
글번호 167678
답변완료
시스템식 부탁드립니다.
항상 도움 주셔서 감사합니다.
종목 : 해외선물
차트 : 5분봉
최초 매수, 매도 진입이후 10틱 간격으로 불타기나 물타기 할경우
실제 진입한 가격을 보면 같은 가격에 진입되는 경우가 많은것 같습니다.
요청사항1 :
저는 일정한 간격으로 불타기나 물타기를 하고 싶습니다.
최대한 정확한 진입가격을 위한 방법이 무엇인지 도움 부탁드립니다.
[일정한 간격으로 진입]
요청사항2 :
청산할때 일정계약수 이하에서는 개별청산,
일정계약수 이상에서는 평균진입가보다 10틱이상일 경우 일괄청산 하고 싶습니다.
[개별청산은 진입건보다 10틱이상 수익시 청산
[일괄청산은 남아있는 계약의 평균가격 대비 10틱 이상 수익이면 일괄청산]
# 매수의 경우
var : 이평(0) ;
이평 = ma(C,20) ;
if marketposition == 0 and C > 이평 then
buy("b",atlimit,C,1) ;
매수가격 = entryprice ;
# 불타기
# 방법1
if marketposition == 1 then
{
buy("b2",atlimit,매수가격+10*pricescale*2,1) ;
buy("b3",atlimit,매수가격+10*pricescale*3,1) ;
buy("b4",atlimit,매수가격+10*pricescale*4,1) ;
buy("b5",atlimit,매수가격+10*pricescale*5,1) ;
buy("b6",atlimit,매수가격+10*pricescale*6,1) ;
# 방법2
if marketposition == 1 then
{
if MaxEntries == 1 Then
buy("b2",atlimit,매수가격+10*pricescale*2,1) ;
if MaxEntries == 2 Then
buy("b3",atlimit,매수가격+10*pricescale*3,1) ;
if MaxEntries == 3 Then
buy("b4",atlimit,매수가격+10*pricescale*4,1) ;
if MaxEntries == 4 Then
buy("b5",atlimit,매수가격+10*pricescale*5,1) ;
if MaxEntries == 5 Then
buy("b6",atlimit,매수가격+10*pricescale*6,1) ;
}
#방법3
if MarketPosition == 1 Then
{
if highest(H,BarsSinceEntry) < 매수가격-10*pricescale*2 Then
Buy("b2",AtLimit,매수가격+10*pricescale*MaxEntries,amt);
if highest(H,BarsSinceEntry) < 매수가격-10*pricescale*3 Then
Buy("b3",AtLimit,매수가격+10*pricescale*MaxEntries,amt);
if highest(H,BarsSinceEntry) < 매수가격-10*pricescale*4 Then
Buy("b4",AtLimit,매수가격+10*pricescale*MaxEntries,amt);
if highest(H,BarsSinceEntry) < 매수가격-10*pricescale*5 Then
Buy("b5",AtLimit,매수가격+10*pricescale*MaxEntries,amt);
if highest(H,BarsSinceEntry) < 매수가격-10*pricescale*6 Then
Buy("b6",AtLimit,매수가격+10*pricescale*MaxEntries,amt);
}
# 위 셋중 어느방법이 더 정확하게 진입이 되나요?
# 위 방법외에 더 정확한 진입을 위한 수식이 있으면 수정 부탁드립니다.
# 물타기
# 방법1
if marketposition == 1 then
buy("bb2",atlimit,매수가격-10*pricescale*2,1) ;
buy("bb3",atlimit,매수가격-10*pricescale*3,1) ;
buy("bb4",atlimit,매수가격-10*pricescale*4,1) ;
buy("bb5",atlimit,매수가격-10*pricescale*5,1) ;
buy("bb6",atlimit,매수가격-10*pricescale*6,1) ;
# 방법2
if marketposition == 1 then
{
if MaxEntries == 1 Then
buy("b2",atlimit,매수가격-10*pricescale*2,1) ;
if MaxEntries == 2 Then
buy("b3",atlimit,매수가격-10*pricescale*3,1) ;
if MaxEntries == 3 Then
buy("b4",atlimit,매수가격-10*pricescale*4,1) ;
if MaxEntries == 4 Then
buy("b5",atlimit,매수가격-10*pricescale*5,1) ;
if MaxEntries == 5 Then
buy("b6",atlimit,매수가격-10*pricescale*6,1) ;
}
#방법3
if MarketPosition == 1 Then
{
if lowest(L,BarsSinceEntry) > 매수가격-10*pricescale*2 Then
Buy("b2",AtLimit,매수가격-10*pricescale*MaxEntries,amt);
if lowest(L,BarsSinceEntry) > 매수가격-10*pricescale*3 Then
Buy("b3",AtLimit,매수가격-10*pricescale*MaxEntries,amt);
if lowest(L,BarsSinceEntry) > 매수가격-10*pricescale*4 Then
Buy("b4",AtLimit,매수가격-10*pricescale*MaxEntries,amt);
if lowest(L,BarsSinceEntry) > 매수가격-10*pricescale*5 Then
Buy("b5",AtLimit,매수가격-10*pricescale*MaxEntries,amt);
if lowest(L,BarsSinceEntry) > 매수가격-10*pricescale*6 Then
Buy("b6",AtLimit,매수가격-10*pricescale*MaxEntries,amt);
}
# 개별청산
if MarketPosition == 1 and CurrentContracts < 3 Then
{
SetStopProfittarget(PriceScale*10,PointStop);
}
Else
SetStopProfittarget(0);
# 일괄청산
#방법1:
if MarketPosition == 1 and CurrentContracts >= 3 Then
{
exitlong("bx",atlimit,avgentryprice-PriceScale*10,PointStop);
}
#방법2:
if MarketPosition == 1 and CurrentContracts >= 3 Then
{
if openpositionprofit/0.025[틱사이즈] < 10*pricescap then
exitlong("bx",atlimit,c,PointStop);
}
# 둘중 어느것이 더 정확한 코딩인가요?
# 위 방법외에 더 정확한 청산을 위한 방법이 있으면 수정 부탁드립니다.
도움 부탁드립니다.
감사합니다.
2023-03-29
1248
글번호 167677
답변완료
YesSpotMaker 클래스가 등록되지 않았습니다
안녕하세요,
다른 컴으로 YTS를 옮기는 과정에서 발생한 일인데,
YesSpot 스크립트에 대한 스크립트 검증 과정에서 제목과 같은 메시지가 뜹니다.
문제가 뭘까요?
2023-03-29
1024
글번호 167676
답변완료
함수요청
안녕하세요?
신호발생시 1틱 아래서 매수신호 1틱 위에서 매도신호를 생성하고 싶습니다.
가령 5일 20일 골든크로스 발생시 익봉 시가 한틱 아래서 매수처럼요
1틱이라는게 호가에 물량이 있고 없고 개념이 아닌 단순 ticksize로 계산하여 수식으로 요청드립니다.
2023-03-29
1294
글번호 167675
답변완료
거래량 관련 지표 문의 드립니다.
안녕하세요? 업무에 노고가 많으십니다.
다름이 아니라 하기 조건의 지표 수식을 좀 알려 주시면 대단히 감사하겠습니다.
조건 :
분봉 ( 3분 5분 etc. )
분봉 종가상 거래량 얼마 이상 ( ex. 1000 etc. )
출력 :
분봉 시가 및 종가에 수평선 표시. ( 우측 연장 )
이상입니다.
2023-03-29
989
글번호 167674
답변완료
부탁드립니다
상세한 답변 감사 합니다
f MarketPosition == 0 and IsExitName("매수2청",1) == true and
10 > 60 Then buy("매수2진입");
위수식을 직전 (매수2청)청산된 가격보다 1.5% 하락한때(작을때) 매수2진입~~~으로
바꾸어 작성부탁드립니다~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
아래수식을 진입된 포지션보다 (1.2%상승때) 매수2청
진입된 포지션보다 (0.7%하락때) 매도2청 으로 부탁드립니다~~
if PositionProfit(0) < 0 and 30 < 60 Then exitlong("매수2청"); (1.2%상승때)
if PositionProfit(0) > 0 and 30 > 60 Then ExitShort("매도2청"); (0.7%하락때)
수고하세요~~
2023-03-29
1579
글번호 167672