커뮤니티
예스랭귀지 Q&A
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1383
글번호 230811
답변완료
지표 질문입니다
틱 차트에서
전일 오후 3시 이후~종가 구간내 최저가를 표시한다
금일 오전 시가부터~9시5분 까지 최고가를 표시한다
감사합니다
2024-08-07
961
글번호 182335
답변완료
시스템트레이딩 수식 부탁드립니다.
안녕하세요?
시스템 트레이딩에 사용할 것이구요.
분봉에 사용 예정, period는 30입니다.
1.
cci가 0선 상향돌파하면 매수
cci가 0선 하향돌파하면 매도청산하려고 합니다.
또 하나의 식을 부탁드려봅니다.
2. 주가가 30선 이상일 때만
cci가 0선 상향돌파하면 매수
cci가 0선 하향돌파하면 매도청산하려고 합니다.
2024-08-07
937
글번호 182328
답변완료
변환 부탁드립니다.
// 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/
// © LuxAlgo
//@version=5
indicator("DTFX Algo Zones [LuxAlgo]", shorttitle = "LuxAlgo - DTFX Algo Zones", overlay = true, max_boxes_count = 500, max_lines_count = 500)
///---------------------------------------------------------------------------------------------------------------------}
//Inputs
//---------------------------------------------------------------------------------------------------------------------{
structureTog = input.bool(true, title = "Show Swing Points", group = "Structure")
structureLen = input.int(10, title = "Structure Length", group = "Structure")
zoneDispNum = input.int(1, title = "Show Last", group = "Zones", minval = 0)
dispAll = input.bool(true, title = "Display All Zones", tooltip = "Ignores Zone Display # and Displays all Possible Zones.", group = "Zones")
zoneFilter = input.string("Both", title = "Zone Display", options = ["Bullish Only", "Bearish Only", "Both"], group = "Zones")
noOverlap = input.bool(true, title = "Clean-Up Level Overlap", group = "Zones")
fib_group = "              Fib Levels                    Line Style                 Bull | Bear"
f1Tog = input.bool(false, title = "", group = fib_group, inline = "1")
f2Tog = input.bool(true, title = "", group = fib_group, inline = "2")
f3Tog = input.bool(true, title = "", group = fib_group, inline = "3")
f4Tog = input.bool(true, title = "", group = fib_group, inline = "4")
f5Tog = input.bool(false, title = "", group = fib_group, inline = "5")
f1Lvl = f1Tog?input.float(0, title = "", group = fib_group, inline = "1"):na
f2Lvl = f2Tog?input.float(0.3, title = "", group = fib_group, inline = "2"):na
f3Lvl = f3Tog?input.float(0.5, title = "", group = fib_group, inline = "3"):na
f4Lvl = f4Tog?input.float(0.7, title = "", group = fib_group, inline = "4"):na
f5Lvl = f5Tog?input.float(1, title = "", group = fib_group, inline = "5"):na
f1Style = input.string(". . .", title = "", options = ["___","- - -",". . ."], group = fib_group, inline = "1")
f2Style = input.string("- - -", title = "", options = ["___","- - -",". . ."], group = fib_group, inline = "2")
f3Style = input.string("___", title = "", options = ["___","- - -",". . ."], group = fib_group, inline = "3")
f4Style = input.string("- - -", title = "", options = ["___","- - -",". . ."], group = fib_group, inline = "4")
f5Style = input.string(". . .", title = "", options = ["___","- - -",". . ."], group = fib_group, inline = "5")
f1BullColor = input.color(#089981, title = "", group = fib_group, inline = "1")
f2BullColor = input.color(#089981, title = "", group = fib_group, inline = "2")
f3BullColor = input.color(#089981, title = "", group = fib_group, inline = "3")
f4BullColor = input.color(#089981, title = "", group = fib_group, inline = "4")
f5BullColor = input.color(#089981, title = "", group = fib_group, inline = "5")
f1BearColor = input.color(#f23645, title = "", group = fib_group, inline = "1")
f2BearColor = input.color(#f23645, title = "", group = fib_group, inline = "2")
f3BearColor = input.color(#f23645, title = "", group = fib_group, inline = "3")
f4BearColor = input.color(#f23645, title = "", group = fib_group, inline = "4")
f5BearColor = input.color(#f23645, title = "", group = fib_group, inline = "5")
structureColor = input.color(color.gray, title = "Structure Color", group = "Style")
bullZoneColor = input.color(color.new(#089981,80), title = "Bullish Zone Color", group = "Style")
bearZoneColor = input.color(color.new(#f23645,80), title = "Bearish Zone Color", group = "Style")
//---------------------------------------------------------------------------------------------------------------------}
//UDTs
//---------------------------------------------------------------------------------------------------------------------{
type pb
float price
int bar
type fs
line f1
line f2
line f3
line f4
line f5
//---------------------------------------------------------------------------------------------------------------------}
//Functions
//---------------------------------------------------------------------------------------------------------------------{
linestyle(_input) =>
_input == "___"?line.style_solid:
_input == "- - -"?line.style_dashed:
_input == ". . ."?line.style_dotted:
na
get_fibs(_top,_bot,_dir,_fl1,_fl2,_fl3,_fl4,_fl5) =>
rng = _dir == 1 ? _top - _bot : _bot - _top
anchor = _dir == 1 ? _bot : _top
fib1 = anchor + (rng*_fl1)
fib2 = anchor + (rng*_fl2)
fib3 = anchor + (rng*_fl3)
fib4 = anchor + (rng*_fl4)
fib5 = anchor + (rng*_fl5)
[fib1,fib2,fib3,fib4,fib5]
//---------------------------------------------------------------------------------------------------------------------}
//Calcs
//---------------------------------------------------------------------------------------------------------------------{
var int dir = 0
float top = na
float btm = na
var pb t = pb.new(na,na)
var pb b = pb.new(na,na)
var bool bos_up_check = false
var bool bos_down_check = false
var string last_bot = "NA"
var string last_top = "NA"
var zones = array.new_box()
var lvls = array.new<fs>()
var box live_zone = na
var fs live_lvls = fs.new(na,na,na,na,na)
upper = ta.highest(structureLen)
lower = ta.lowest(structureLen)
if dir >= 0 and high[structureLen] > upper
dir := -1
top := high[structureLen]
if dir <= 0 and low[structureLen] < lower
dir := 1
btm := low[structureLen]
top_conf = not na(top)
bot_conf = not na(btm)
int structure_confirmed = 0
if top_conf
t := pb.new(top,bar_index-structureLen)
bos_up_check := true
if structureTog
structure_confirmed := 1
if bot_conf
b := pb.new(btm,bar_index-structureLen)
bos_down_check := true
if structureTog
structure_confirmed := -1
plotshape(structure_confirmed>0?true:false, style = shape.circle, title = "Swing High", location = location.abovebar, offset = -structureLen, color = structureColor)
plotshape(structure_confirmed<0?true:false, style = shape.circle, title = "Swing Low", location = location.belowbar, offset = -structureLen, color = structureColor)
HH = top_conf and t.price > t.price[1]
HL = bot_conf and b.price > b.price[1]
LH = top_conf and t.price < t.price[1]
LL = bot_conf and b.price < b.price[1]
last_top := HH?"HH":LH?"LH":last_top
last_bot := LL?"LL":HL?"HL":last_bot
var int t_dir = 0
choch_up = ta.crossover(close,t.price) and (high == upper) and t_dir <= 0
choch_down = ta.crossunder(close,b.price) and (low == lower) and t_dir >= 0
if choch_up
t_dir := 1
if choch_down
t_dir := -1
bos_up = ta.crossover(close,t.price) and bos_up_check and t_dir >= 0
bos_down = ta.crossunder(close,b.price) and bos_down_check and t_dir <= 0
mss_up = bos_up or choch_up
mss_down = bos_down or choch_down
if mss_up
bos_up_check := false
if zoneFilter != "Bearish Only"
_top = t.price
_bot = dir == -1 ? lower : dir == 1 ? b.price : 0
[fib1,fib2,fib3,fib4,fib5] = get_fibs(_top,_bot,1,f1Lvl,f2Lvl,f3Lvl,f4Lvl,f5Lvl)
live_zone := box.new(t.bar,_top,bar_index,_bot,bgcolor = bullZoneColor,border_color = na)
live_lvls := fs.new(
line.new(t.bar,(f1Tog?fib1:na),bar_index,fib1, color = f1BullColor, style = linestyle(f1Style)),
line.new(t.bar,(f2Tog?fib2:na),bar_index,fib2, color = f2BullColor, style = linestyle(f2Style)),
line.new(t.bar,(f3Tog?fib3:na),bar_index,fib3, color = f3BullColor, style = linestyle(f3Style)),
line.new(t.bar,(f4Tog?fib4:na),bar_index,fib4, color = f4BullColor, style = linestyle(f4Style)),
line.new(t.bar,(f5Tog?fib5:na),bar_index,fib5, color = f5BullColor, style = linestyle(f5Style))
)
zones.push(live_zone)
lvls.push(live_lvls)
if mss_down
bos_down_check := false
if zoneFilter != "Bullish Only"
_top = dir == 1 ? upper : dir == -1 ? t.price : 0
_bot = b.price
[fib1,fib2,fib3,fib4,fib5] = get_fibs(_top,_bot,-1,f1Lvl,f2Lvl,f3Lvl,f4Lvl,f5Lvl)
live_zone := box.new(b.bar,_top,bar_index,_bot,bgcolor = bearZoneColor,border_color = na)
live_lvls := fs.new(
line.new(b.bar,(f1Tog?fib1:na),bar_index,fib1, color = f1BearColor, style = linestyle(f1Style)),
line.new(b.bar,(f2Tog?fib2:na),bar_index,fib2, color = f2BearColor, style = linestyle(f2Style)),
line.new(b.bar,(f3Tog?fib3:na),bar_index,fib3, color = f3BearColor, style = linestyle(f3Style)),
line.new(b.bar,(f4Tog?fib4:na),bar_index,fib4, color = f4BearColor, style = linestyle(f4Style)),
line.new(b.bar,(f5Tog?fib5:na),bar_index,fib5, color = f5BearColor, style = linestyle(f5Style))
)
zones.push(live_zone)
lvls.push(live_lvls)
if zones.size() > zoneDispNum and not dispAll
zones.shift().delete()
ln = lvls.shift()
ln.f1.delete()
ln.f2.delete()
ln.f3.delete()
ln.f4.delete()
ln.f5.delete()
if lvls.size() > 1 and noOverlap
last_zone = zones.get(zones.size()-2)
last_lvl = lvls.get(lvls.size()-2)
if last_lvl.f1.get_x2() > live_lvls.f1.get_x1()
last_lvl.f1.set_x2(math.max(live_zone.get_left(),last_zone.get_right()))
last_lvl.f2.set_x2(math.max(live_zone.get_left(),last_zone.get_right()))
last_lvl.f3.set_x2(math.max(live_zone.get_left(),last_zone.get_right()))
last_lvl.f4.set_x2(math.max(live_zone.get_left(),last_zone.get_right()))
last_lvl.f5.set_x2(math.max(live_zone.get_left(),last_zone.get_right()))
live_lvls.f1.set_x1(math.max(live_zone.get_left(),last_zone.get_right()))
live_lvls.f2.set_x1(math.max(live_zone.get_left(),last_zone.get_right()))
live_lvls.f3.set_x1(math.max(live_zone.get_left(),last_zone.get_right()))
live_lvls.f4.set_x1(math.max(live_zone.get_left(),last_zone.get_right()))
live_lvls.f5.set_x1(math.max(live_zone.get_left(),last_zone.get_right()))
live_lvls.f1.set_x2(bar_index)
live_lvls.f2.set_x2(bar_index)
live_lvls.f3.set_x2(bar_index)
live_lvls.f4.set_x2(bar_index)
live_lvls.f5.set_x2(bar_index)
//---------------------------------------------------------------------------------------------------------------------}
2024-08-07
1161
글번호 182318
답변완료
거래량 막대 색깔 변경
안녕하세요..
거래량 막대 새깔을 이전봉종가 기준으로 이전봉종가 보다 높으면 빨강으로 낮으면 파랑으로 설정하고 싶은데 어떻게 하면 될까요? 부탁드립니다..
2024-08-07
1096
글번호 182315
답변완료
다시 질문드립니다.
제가 질문한 의도를 잘못 해석하신듯해서 다시 설명드릴게요
처음에 질문한 내요은 다음과 같습니다.
" 1분봉으로 MACD 기준선 0을 골드 크로스 , 데드 크로스로 매매 타점을 잡았다고 가정하겠습니다.
그런데 10분봉에서 양봉일경우에는 1분봉 골드크로스 매수 타점만 발생시키고,
10분봉에서 음봉일 경우에는 , 1분봉 데드 크로스 매도 타점만 발생시키고 싶습니다."
답변주신 수식
input : 타주기분(10);
input : short(12),long(26),sig(9);
var : S1(0),D1(0),TM(0),TF(0);
var : MACDV(0),MACDS(0);
macdv = macd(short,long);
macds = ema(macdv,sig);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
var1 = Open; // var1 = 시가
}
if CrossUp(MACDV,0) and C > var1 Then
Buy();
if CrossDown(MACDV,0) and C < var1 Then
Sell();
}
제가 의도한 내용은 현재 1분봉으로 매매기준을 삼아서 매매를 하고 있습니다.
그런데, 10분봉상 음봉상태에서 1분봉의 매매타점이 나오는 경우가 있습니다.
그런경우 10분봉상 음봉이면 1분봉에서 매매타점이 나오더라도, 매수하지 않게 하려는 수식구성을 하고자 하는 것입니다.
위에서 답변 주신 수식은 저의 의도와는 다른 수식인듯 합니다.
즉, 다시 정리하면
10분봉에서 양봉기준이 나오면, 1분봉에서 macd 매수 타점만 발생
10분봉에서 음봉기준이 나오면 , 1분봉에서 macd 매도 타점만 발생
이게 핵심입니다.
타 주기를 현재 봉 기준으로 넣어서 매매하고자 하는게 아님을 인지해주시고 , 수식 구성 부탁합니다.
2024-08-07
912
글번호 182314
ksks 님에 의해서 삭제되었습니다.
2024-08-07
8
글번호 182313
답변완료
트레일링스탑에서
SD를 가지고 트레이링스탑을 적용해봤는데 정확하게 떨어지지 않네요
트레일링개념에 대한 이해가 부족한듯합니다
아래와 같이 했는데 그림에서 SD값이 24.93에 청산되어야 하지 않나요?
그리고 진입봉SD와 진입이후 최저값차가 55인데 산식이 적용된 이유도 잘 모르겠구요....
산식검토 부탁드립니다
If SD[BarsSinceEntry+1]-Lowest(SD,BarsSinceEntry)>55 Then {
if (Lowest(SD,BarsSinceEntry)+ ( SD[BarsSinceEntry+1]- Lowest(SD,BarsSinceEntry) )*0.25)<SD Then
ExitShort("ES05");
}
If SD[BarsSinceEntry+1]-Lowest(SD,BarsSinceEntry)<=55 Then
ExitShort("ES051");
2024-08-07
939
글번호 182312
답변완료
30분봉 기준 종목검색식 문의 드립니다.
종목검색식 부탁드립니다.
요즘 워낙 장이 어려워 30분봉 기준으로 눌림목 음봉고가 돌파 종목을 검색해보고 싶습니다.검색식 검토 부탁드립니다.
1. 전일종가 대비 시가 등락률 5%(갭이 5%) 이내
2. 30분 첫봉 종가등락률이 전일대비 10%이하(갭 포함 10% 이하) 이며 종가기준 120 이평 이상(30분봉상)
3. 30분봉 2번째, 또는 3번째 봉이 음봉 발생(시가>종가)
// 양음양 양음음 양양음 상관없이 3봉중 음봉이 발생하면 됨
4. 4번째봉 이후에서 2,3번째 음봉의 최고가를 돌파하는 양봉발생 종목
5. 30분봉 첫봉 거래량: 전일 30분봉 기준 최고 거래량의 70% 이상
감사합니다.
2024-08-06
1294
글번호 182310
답변완료
일봉 볼린저 밴드를 분봉에 표시
안녕하세요.
지표로 일봉 볼린저 밴드를 이용하여 분봉 차트에서 거래를 하고 싶습니다.
일봉 볼린저 밴드를 분봉에 표시할 수 있는 수식을 부탁드립니다.
제가 도저히 만들 수가 없네요. ㅠㅠ
감사합니다.
2024-08-06
1553
글번호 182308