커뮤니티
예스랭귀지 Q&A
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1367
글번호 230811
답변완료
수고하십니다
항상노고에 감사드리며 트레이딩뷰챠트인데 변환 부탁드립니다
주말 잘보내세요
/@version=5
indicator("DSL Trend Analysis [ChartPrime]", overlay = true)
// --------------------------------------------------------------------------------------------------------------------}
// 𝙐𝙎𝙀𝙍 𝙄𝙉𝙋𝙐𝙏𝙎
// --------------------------------------------------------------------------------------------------------------------{
int len = input.int(10, "Length") // Length for calculating DSL
int offset = input(30, "Offset") // Offset for threshold levels
float width = input.float(1, "Bands Width", step = 0.1, maxval = 2, minval = 0.5) // Width for ATR-based bands
// Colors for upper and lower trends
color upper_col = input.color(color.lime, "+", inline = "col")
color lower_col = input.color(color.orange, "-", inline = "col")
// --------------------------------------------------------------------------------------------------------------------}
// 𝙄𝙉𝘿𝙄𝘾𝘼𝙏𝙊𝙍 𝘾𝘼𝙇𝘾𝙐𝙇𝘼𝙏𝙄𝙊𝙉𝙎
// --------------------------------------------------------------------------------------------------------------------{
// Function to calculate DSL lines based on price
dsl_price(float price, int len) =>
// Initialize DSL lines as NaN (not plotted by default)
float dsl_up = na
float dsl_dn = na
float sma = ta.sma(price, len)
// Dynamic upper and lower thresholds calculated with offset
float threshold_up = ta.highest(len)[offset]
float threshold_dn = ta.lowest(len)[offset]
// Calculate the DSL upper and lower lines based on price compared to the thresholds
dsl_up := price > threshold_up ? sma : dsl_up[1]
dsl_dn := price < threshold_dn ? sma : dsl_dn[1]
// Return both DSL lines
[dsl_up, dsl_dn]
// Function to calculate DSL bands based on ATR and width multiplier
dsl_bands(float dsl_up, float dsl_dn) =>
float atr = ta.atr(200) * width // ATR-based calculation for bands
float upper = dsl_up - atr // Upper DSL band
float lower = dsl_dn + atr // Lower DSL band
[upper, lower]
// Get DSL values based on the closing price
[dsl_up, dsl_dn] = dsl_price(close, len)
// Calculate the bands around the DSL lines
[dsl_up1, dsl_dn1] = dsl_bands(dsl_up, dsl_dn)
// Linear regression on the close price over a short period
float linreg = ta.linreg(close, 5, 0)
// Determine the trend color based on the relationship between price, DSL lines, and bands
color trend_col =
high > dsl_up1 and high < dsl_up and high > dsl_dn1
? color.new(upper_col, 60)
: low > dsl_dn and low < dsl_dn1
? color.new(lower_col, 60)
: high > dsl_up
? upper_col
: low < dsl_dn
? lower_col
: na
// --------------------------------------------------------------------------------------------------------------------}
// 𝙑𝙄𝙎𝙐𝘼𝙇𝙄𝙕𝘼𝙏𝙄𝙊𝙉
// --------------------------------------------------------------------------------------------------------------------{
// Plot the linear regression with color based on trend analysis
plot(linreg, "Trend Line", color = trend_col, linewidth=4, style = plot.style_linebr, force_overlay = false)
// If it's the last bar, display labels for the DSL upper and lower bands
if barstate.islast
label.delete(label.new(bar_index + 5, dsl_up, "Upper Band₩n" + str.tostring(dsl_up, "#.##"), style = label.style_label_left, color = color(na), textcolor = chart.fg_color)[1])
label.delete(label.new(bar_index + 5, dsl_dn, "Lower Band₩n" + str.tostring(dsl_dn, "#.##"), style = label.style_label_left, color = color(na), textcolor = chart.fg_color)[1])
// Plot the DSL lines on the chart
pu = plot(dsl_up, color=color.gray, linewidth=1, title="DSL Up")
pd = plot(dsl_dn, color=color.gray, linewidth=1, title="DSL Down")
// Plot the DSL bands
pu1 = plot(dsl_up1, color=color.gray, linewidth=1, title="DSL Upper Band")
pd1 = plot(dsl_dn1, color=color.gray, linewidth=1, title="DSL Lower Band")
// Fill the space between the DSL lines and bands with color
fill(pu, pu1, dsl_up, dsl_up1, color.new(upper_col, 80), color.new(upper_col, 90))
fill(pd, pd1, dsl_dn, dsl_dn1, color.new(lower_col, 80), color.new(lower_col, 90))
// Uncomment the following line to plot candles with trend color
// plotcandle(open, high, low, close, title='Title', color = trend_col, wickcolor=trend_col, bordercolor = trend_col)
// --------------------------------------------------------------------------------------------------------------------}
2024-10-24
856
글번호 184562
답변완료
추세전환 일정 크기 이상
input : Period(100);
Var:j(0),T(0),txx(0);
Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0),
date21(0),date22(0),time21(0),time22(0),
date31(0),date32(0),time31(0),time32(0),tx(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
Plot1(value12);
For j = 0 To 19
{
HiBar[j] = HiBar[j] + 1;
LoBar[j] = LoBar[j] + 1;
}
if crossup(c,highest(H,Period)[1]) Then
T = 1;
if CrossDown(c,Lowest(L,Period)[1]) Then
T = -1;
If T == -1 Then
{
If T[1] != -1 Then
{
For j = 18 DownTo 0
{
LoVal[j+1] = LoVal[j];
LoBar[j+1] = LoBar[j];
}
LoVal[0] = L;
LoBar[0] = 0;
date11 = date[HiBar[0]];
time11 = stime[HiBar[0]];
Value11 = HiVal[0];
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
TL_Delete(TL);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(TL1,Blue);
date21 = date[HiBar[0]];
time21 = stime[HiBar[0]];
date22 = date[0];
time22 = stime[0];
if abs(value12[1]-value11[1]) < 0.5 Then
Text_Delete(tx);
tx = Text_New(sDate,stime,value12,NumToStr(value11-value12,2));
Text_SetColor(Tx,Blue);
Text_SetStyle(tx,1,0);
Text_SetSize(tx,25);
Text_SetBold(tx,1);
}
If LoVal[0] > L Then
{
LoVal[0] = L;
LoBar[0] = 0;
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date22 = date[0];
time22 = stime[0];
Text_SetString(tx,NumToStr(value11-value12,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
}
If T == 1 Then
{
If T[1] != 1 Then
{
For j = 18 DownTo 0
{
HiVal[j+1] = HiVal[j];
HiBar[j+1] = HiBar[j];
}
HiVal[0] = H;
HiBar[0] = 0;
date11 = date[LoBar[0]];
time11 = stime[LoBar[0]];
Value11 = LoVal[0];
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_Delete(TL);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(TL1,Red);
date31 = date[LoBar[0]];
time31 = stime[LoBar[0]];
date32 = date[0];
time32 = stime[0];
if abs(value12[1]-value11[1]) < 0.5 Then
Text_Delete(tx);
tx = Text_New(sDate,stime,value12,NumToStr(value12-value11,2));
Text_SetColor(Tx,Red);
Text_SetStyle(tx,1,1);
Text_SetSize(tx,25);
Text_SetBold(tx,1);
}
If HiVal[0] < H Then
{
HiVal[0] = H;
HiBar[0] = 0;
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date32 = date[0];
time32 = stime[0];
Text_SetString(tx,NumToStr(value12-value11,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
}
TL_SetSize(TL1,1);
0.5보다 작아도 조건만 맞으면 바뀌는 추세 전환을,
조건이 맞아도 강제로 보류하고 있다가,
새 추세선의 크기가 0.5 이상이 될 때, 추세 전환으로 변경.
즉 전환 조건에 새 추세선 크기가 0.5 이상일 때 추가. 감사합니다.
2024-10-24
801
글번호 184561
살빼고싶다 님에 의해서 삭제되었습니다.
2024-10-24
83
글번호 184560
답변완료
문의 드립니다
키움에서 쓰는 슈퍼트렌드 지표수식으로 검색식을 만들고 싶습니다.
A = supertrend(period, multiplier);
ValueWhen(1, CrossUp(C, A), A(1));
지표조건
period: 14
multiplier: 3
한가지 더 부탁 드리고 싶은것은 키움에서 저 수식으로 지표를 만들어서 보면 선이 위에서 떨어지는 경우가 있고 밑에서 위로 올라가는 경우도 있던데 떨어지는 부분만 검색이 가능 하도록 할 수도 있을런지요?
2024-10-24
778
글번호 184559
답변완료
종목검색식 요청드립니다.
N봉 이내에 15%이상 상승했던 종목을 검색하는 검색식을 만들고 싶습니다. 도움 부탁드립니다.
N봉과 상승률(15%)는 조정가능하도록 부탁드립니다.
감사합니다.
2024-10-24
699
글번호 184558
답변완료
문의 드립니다
안녕하세요
1. 다음 슈퍼트랜드 지표에 일목 기준선을 추가하고 uptrand가 기준선위에 있으면
노랑색으로 채우고 downtrand가 기준선 아래 있으면 파랑색으로 두선사이을 색으로
채우고자합니다
input : Periods(10);
input : Multiplier(3.0);
input : changeATR(1);#1:SMA 0:RMA
var : src(0),alpha(0),source(0),ATR1(0),ATR2(0),ATRV(0);
var : up(0),up1(0),dn(0),dn1(0),trend(0),tx(0);
src = (H+L)/2;
alpha = 1 / Periods;
atr1 = IFf(IsNan(atr1[1]) == true , ma(TrueRange, Periods) , alpha * TrueRange + (1 - alpha) * atr1[1]);
atr2 = ATR(Periods);
atrv = IFf(changeATR == 1 , atr1 , atr2);
up=src-(Multiplier*atrv);
up1 = IFf(IsNan(up[1]) == False,up[1],up);
up = iff(close[1] > up1 , max(up,up1) , up);
dn=src+(Multiplier*atrv);
dn1 = IFf(IsNan(dn[1]) == False,dn[1], dn);
dn = iff(close[1] < dn1 , min(dn, dn1) , dn);
trend = 1;
trend = IFf(IsNan(trend[1]) == False,trend[1], trend);
trend = IFf(trend == -1 and close > dn1 , 1 , iff(trend == 1 and close < up1 , -1 , trend));
if trend == 1 Then
plot1(up,"UpTrend",White);
Else
NoPlot(1);
if trend == -1 then
Plot2(dn,"Down Trend",Black);
Else
NoPlot(2);
if trend == 1 and trend[1] == -1 Then
{
tx =Text_New(sDate,sTime,up,"●");
Text_SetStyle(tx,1,1);
Text_SetColor(tx,Red);
}
if trend == -1 and trend[1] == 1 Then
{
tx =Text_New(sDate,sTime,dn,"●");
Text_SetStyle(tx,1,1);
Text_SetColor(tx,Blue);
}
2.다음 트레이딩뷰 지표 전환입니다
period=input(title="Period", defval=10)
len=input(title="Period", defval=10)
smaHigh=sma(high, len)
smaLow=sma(low, len)
Hlv = na
Hlv := close > smaHigh ? 1 : close < smaLow ? -1 : Hlv[1]
sslDown = Hlv < 0 ? smaHigh: smaLow
sslUp = Hlv < 0 ? smaLow : smaHigh
plot(sslDown, linewidth=2, color=red)
plot(sslUp, linewidth=2, color=lime)
감사합니다
2024-10-24
709
글번호 184551
답변완료
문의드립니다
Input : Period(20), MultiD(2);
var : MAv(0),BBup(0),BBdn(0);
MAv = ma(C,Period);
BBup = BollBandUp(Period,MultiD);
BBdn = BollBandDown(Period,MultiD);
Plot1(MAv, "이평");
Plot2(BBup, "상단밴드");
Plot3(BBdn, "하단밴드");
............................................................
1.
Plot2(BBup, "상단밴드")를 증감을 표현할 수 있는 막대그래프(상단 밴드값이 증가하면 빨간색, 감소하면 파란색 막대)로 구현하고 싶습니다
2.
Plot3(BBdn, "하단밴드");를 증감을 표현할 수 있는 막대그래프(하단 밴드값이 증가하면 빨간색, 감소하면 파란색 막대)로 구현하고 싶습니다
상단밴드, 하단밴드 각각 단독의 지표로 구현해주세요
감사합니다.
2024-10-24
812
글번호 184550
답변완료
문의
항상 감사드립니다.
아래 지표를 주식이나 선물과 연동해서 다이버전스 신호를 만들고 싶습니다.
부탁 드립니다.
감사합니다.
Input : Period(1);
Var : value(0);
value = ma(bids,period)-ma(asks,period);#호가잔량이동평균오실레이터
if date != date[1] Then{
value1 = value;
value2 = value;
}
if value > value1 Then
value1 = value;
if value < value2 Then
value2 = value;
If value > value[35] Then
Plot1(value, "호가잔량이평오실레이터",RED);
Else
Plot1(value, "호가잔량이평오실레이터",BLUE);
plot2(value1,"당일최고");
plot3(value2,"당일최저");
PlotBaseLine1(0,"기준선");
2024-10-24
625
글번호 184549
답변완료
문의
평균 30일 거래량보다 3000% 많은 거래량이 생기면 다음날 매수
하는 식을 구하고 싶은데 ㅠㅠ 아래 코딩에서 문제가 있는 부분이 있는걸까요?
// 변수 설정
avg_vol = MovingAverage(Volume, 30); // 30일간의 평균 거래량
current_vol = Volume; // 현재 거래량
condition = 0; // 조건을 저장할 변수
// 조건: 현재 거래량이 30일 평균 거래량보다 3000% 이상일 때
if (current_vol > avg_vol * 30) {
condition = 1; // 조건이 만족되면 1로 설정
}
// 다음날 조건이 충족된 경우 매수 실행
if (condition[1] == 1) {
Buy(); // 매수 신호 발생
condition = 0; // 매수 후 조건 초기화
}
2024-10-24
756
글번호 184548