커뮤니티
예스랭귀지 Q&A
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1317
글번호 230811
남한산성 님에 의해서 삭제되었습니다.
2025-05-10
73
글번호 190708
답변완료
수식 수정 부탁드립니다.
안녕하세요.
예전에 트레일링스탑 청산전략이 포함된 피라미딩 매매전략을 문의한 결과 아래와 같은 수식을 작성해 주셨습니다.
var : HH1(0),HH2(0),HH3(0),HH4(0),HH5(0);
var : EP1(0),EP2(0),EP3(0),EP4(0),EP5(0);
if MarketPosition == 0 Then
{
if BuyCond == True Then Buy("Long1", AtMarket);
}
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
if MaxEntries == 1 Then
{
HH1 = LatestEntryPrice(0);
EP1 = LatestEntryPrice(0);
}
if MaxEntries == 2 Then
{
HH2 = LatestEntryPrice(0);
EP2 = LatestEntryPrice(0);
}
if MaxEntries == 3 Then
{
HH3 = LatestEntryPrice(0);
EP3 = LatestEntryPrice(0);
}
if MaxEntries == 4 Then
{
HH4 = LatestEntryPrice(0);
EP4 = LatestEntryPrice(0);
}
if MaxEntries == 5 Then
{
HH5 = LatestEntryPrice(0);
EP5 = LatestEntryPrice(0);
}
}
if MaxEntries >= 1 and H > HH1 Then
HH1 = H;
if MaxEntries >= 2 and H > HH2 Then
HH2 = H;
if MaxEntries >= 3 and H > HH3 Then
HH3 = H;
if MaxEntries >= 4 and H > HH4 Then
HH4 = H;
if MaxEntries >= 5 and H > HH5 Then
HH5 = H;
if MaxEntries == 1 and BuyCond == True Then Buy("Long2", AtMarket);
if MaxEntries == 2 and BuyCond == True Then Buy("Long3", AtMarket);
if MaxEntries == 3 and BuyCond == True Then Buy("Long4", AtMarket);
if MaxEntries == 4 and BuyCond == True Then Buy("Long5", AtMarket);
if MaxEntries >= 1 and HH1-ATR > EP1 Then ExitLong("TStop1", Atstop, HH1 - ATR, "Long1");
if MaxEntries >= 2 and HH1-ATR > EP2 Then ExitLong("TStop2", Atstop, HH2 - ATR, "Long2");
if MaxEntries >= 3 and HH1-ATR > EP3 Then ExitLong("TStop3", Atstop, HH3 - ATR, "Long3");
if MaxEntries >= 4 and HH1-ATR > EP4 Then ExitLong("TStop4", Atstop, HH4 - ATR, "Long4");
if MaxEntries >= 5 and HH1-ATR > EP5 Then ExitLong("TStop5", Atstop, HH5 - ATR, "Long5");
}
Else
{
HH1 = 0;
HH2 = 0;
HH3 = 0;
HH4 = 0;
HH5 = 0;
EP1 = 0;
EP2 = 0;
EP3 = 0;
EP4 = 0;
EP5 = 0;
}
청산전략에서 트레일링 스탑을 적용하되, 반드시 청산가가 진입가보다 높은 경우에만
적용되도록 요청을 드렸는데, 간혹 진입가보다 더 낮은 가격에서 청산되는
경우가 발생하고 있습니다.
그래서, 아래와 같이 변경을 해보았으나, 그래도 진입가보다 더 낮은 가격에서 청산되는
경우가 있었습니다.
아래의 수식이 아닌 100% 진입가보다 높은 가격에서 청산되는 수식을 부탁드리겠습니다.
감사합니다.
if MaxEntries >= 1 and HH1-ATR > EP1*1.1 Then ExitLong("TStop1", Atstop, HH1 - ATR, "Long1");
if MaxEntries >= 2 and HH1-ATR > EP2*1.1 Then ExitLong("TStop2", Atstop, HH2 - ATR, "Long2");
if MaxEntries >= 3 and HH1-ATR > EP3*1.1 Then ExitLong("TStop3", Atstop, HH3 - ATR, "Long3");
if MaxEntries >= 4 and HH1-ATR > EP4*1.1 Then ExitLong("TStop4", Atstop, HH4 - ATR, "Long4");
if MaxEntries >= 5 and HH1-ATR > EP5*1.1 Then ExitLong("TStop5", Atstop, HH5 - ATR, "Long5");
2025-05-10
326
글번호 190707
답변완료
지표전환 요청
study("Divergence Histogram for many indicator", overlay=false, max_bars_back = 4000)
lrb = input(5, title="Pivot Point Period", minval = 1)
mindiv = input(1, title="Minimum #Num of Divergence for Alert", minval = 1)
chcut = input(false, title = "Check Cut-Through in indicators")
// RSI
rsi = rsi(close, 14)
// MACD
[macd, signal, deltamacd] = macd(close, 12, 26, 9)
// Momentum
moment = mom(close, 10)
// CCI
cci = cci(close, 10)
// OBV
Obv = obv // cum(change(close) > 0 ? volume : change(close) < 0 ? -volume : 0 * volume)
// Stoch
stk = sma(stoch(close, high, low, 14), 3)
// DIOSC
DI = change(high) - (-change(low))
trur = rma(tr, 14)
diosc = fixnan(100 * rma(DI, 14) / trur)
// volume weighted macd
maFast = vwma(close, 12)
maSlow = vwma(close, 26)
vwmacd = maFast - maSlow
// Chaikin money flow
Cmfm = ((close-low) - (high-close)) / (high - low)
Cmfv = Cmfm * volume
cmf = sma(Cmfv, 21) / sma(volume,21)
// Moneyt Flow Index
Mfi = mfi(close, 14)
float top = na
float bot = na
top := pivothigh(lrb, lrb)
bot := pivotlow(lrb, lrb)
topc = 0, botc = 0
topc := top ? lrb : nz(topc[1]) + 1
botc := bot ? lrb : nz(botc[1]) + 1
// Negative Divergence (checking possible higher highs(lb=0))
newtop = pivothigh(lrb, 0) // check only left side
emptyh = true
if not na(newtop) and newtop > high[topc] // there must not close price higher than the line between last PH and current high
diff = (newtop - high[topc]) / topc
hline = newtop - diff // virtual line to check there is no close price higher than it
for x = 1 to topc -1
if close[x] > hline
emptyh := false
break
hline := hline - diff
else
emptyh := false
// check cut-through in indicators
nocut1(indi, len)=>
_ret = true
diff = (indi - nz(indi[len])) / len
ln = indi - diff
for x = 1 to len -1
if nz(indi[x]) > ln
_ret := false
break
ln := ln - diff
_ret
rsiokn = nocut1(rsi, topc)
macdokn = nocut1(macd, topc)
deltamacdokn = nocut1(deltamacd, topc)
momentokn = nocut1(moment, topc)
cciokn = nocut1(cci, topc)
obvokn = nocut1(obv, topc)
stkokn = nocut1(stk, topc)
dioscokn = nocut1(diosc, topc)
vwmacdokn = nocut1(vwmacd, topc)
cmfokn = nocut1(cmf, topc)
mfiokn = nocut1(Mfi, topc)
negadiv(indi, isok)=>
_ret = (emptyh and not na(newtop) and indi[topc] > indi and (not chcut or isok))
// Positive Divergence (checking possible Lower lows(lb=0))
newbot = pivotlow(lrb, 0) // check only left side
emptyl = true
if not na(newbot) and newbot < low[botc] // there must not close price lower than the line between last PL and current low
diff = (newbot - low[botc]) / botc
lline = newbot - diff // virtual line to check there is no close price lower than it
for x = 1 to botc -1
if close[x] < lline
emptyl := false
break
lline := lline - diff
else
emptyl := false
// check cut-through in indicators
nocut2(indi, len)=>
_ret = true
diff = (indi - nz(indi[len])) / len
ln = indi - diff
for x = 1 to len -1
if nz(indi[x]) < ln
_ret := false
break
ln := ln - diff
_ret
rsiokp = nocut2(rsi, botc)
macdokp = nocut2(macd, botc)
deltamacdokp = nocut2(deltamacd, botc)
momentokp = nocut2(moment, botc)
cciokp = nocut2(cci, botc)
obvokp = nocut2(obv, botc)
stkokp = nocut2(stk, botc)
dioscokp = nocut2(diosc, botc)
vwmacdokp = nocut2(vwmacd, botc)
cmfokp = nocut2(cmf, botc)
mfiokp = nocut2(Mfi, botc)
posidiv(indi, isok)=>
_ret = (emptyl and not na(newbot) and indi[botc] < indi and (not chcut or isok))
indi1 = iff(posidiv(rsi, rsiokp), 1, iff(negadiv(rsi, rsiokn), -1, 0))
indi2 = iff(posidiv(macd, macdokp), 1, iff(negadiv(macd, macdokn), -1, 0))
indi3 = iff(posidiv(deltamacd, deltamacdokp), 1, iff(negadiv(deltamacd, deltamacdokn), -1, 0))
indi4 = iff(posidiv(moment, momentokp), 1, iff(negadiv(moment, momentokn), -1, 0))
indi5 = iff(posidiv(cci, cciokp), 1, iff(negadiv(cci, cciokn), -1, 0))
indi6 = iff(posidiv(Obv, obvokp), 1, iff(negadiv(Obv, obvokn), -1, 0))
indi7 = iff(posidiv(stk, stkokp), 1, iff(negadiv(stk, stkokn), -1, 0))
indi8 = iff(posidiv(diosc, dioscokp), 1, iff(negadiv(diosc, dioscokn), -1, 0))
indi9 = iff(posidiv(vwmacd, vwmacdokp), 1, iff(negadiv(vwmacd, vwmacdokn), -1, 0))
indi10 = iff(posidiv(cmf, cmfokp), 1, iff(negadiv(cmf, cmfokn), -1, 0))
indi11 = iff(posidiv(Mfi, mfiokp), 1, iff(negadiv(Mfi, mfiokn), -1, 0))
totaldiv = indi1 + indi2 + indi3 + indi4 + indi5 + indi6 + indi7 + indi8 + indi9 + indi10 + indi11
hline(0, color = color.gray, linestyle = hline.style_dotted)
plot(abs(totaldiv), color = totaldiv > 0 ? color.new(color.lime, 0) :totaldiv < 0 ? color.new(color.red, 0) : na, style = plot.style_columns, linewidth = 6)
if totaldiv != 0
label.new(x = bar_index, y = abs(totaldiv), text = tostring(abs(totaldiv)), color = color.new(color.white, 100), textcolor = totaldiv < 0 ? color.red : color.lime)
alertcondition(totaldiv >= mindiv, title='Positive Divergence', message='Positive Divergence')
alertcondition(totaldiv <= -mindiv, title='Negative Divergence', message='Negative Divergence')
파인스크립트지표입니다 실력이 부족해서 예스랭귀지로 전환요청 부탁드립니다
-다른 모델에서 타주기참조로 전환이 어렵다 답변받았는데 가능하다면 5분봉에서라도 가능하다면 돌아가게 가능할지요 부탁드려봅니다
2025-05-10
465
글번호 190706
답변완료
수식변환요청드립니다
수식을검색시으로부탁드립니다
a=envelopeup(10,2);
b=bbandsup(10,2);
b1=obv();
b2=wavg((((c-c(11))/c(11))*100)+(((c-c(14))/c(14))*100),10);
crossup(b,a)&&b1(1)<b1&&b2(1)<b2
2025-05-10
307
글번호 190705
러블리 님에 의해서 삭제되었습니다.
2025-05-09
11
글번호 190704
yamu 님에 의해서 삭제되었습니다.
2025-05-09
1
글번호 190700
답변완료
최적화 주기(기간)문의
분봉에 의해 거래를 하고자합니다.
변수값을 정하기 위해서는 최적화 작업을 거쳐야 하는데 최적화를 해 볼 수있는 최대한 기간(주기)를 알고싶습니다.
2분봉, 3분봉, 5분봉에 대한 최적화할 수 있는 최대한 기간(주기)를 부탁드립니다.
2025-05-09
286
글번호 190686
답변완료
조건식으로 변형부탁드립니다
아래는 키움증권 영웅문에서 쓰고있는 신호수식인데요.. 조건식으로 변형하려고하는데 영웅문에서는 안되네요..
조건식부탁드립니다
60분봉차트조건입니다
목=valuewhen(1,dayclose()>
predayclose()*1.29,dayclose());
표=valuewhen(1,dayclose()>
predayclose()*1.29,dayopen());
가=floor((목+표)/2);
조건 = crossdown(c, 가);
이후 = valuewhen(1, c, 조건);
카운트 = countsince(date!=date(1), 이후);
카운트 == 1&& 카운트(1) == 0
2025-05-09
368
글번호 190683
답변완료
문의드립니다.
이전 문의드린 수식중 아래의 수식을 적용했더니 선의 색상이 파란색으로만 나오고
green과 red는 구현되지 않습니다. 또한 선이 직선처럼 나와야 하는데 휩소처럼 나옵니다.
다시한번부탁드립니다.
==========================
study(title="Average True Range Trailing Stops Strategy, by Sylvain Vervoort", overlay = true)
nATRPeriod = input(5)
nATRMultip = input(3.5)
xATR = atr(nATRPeriod)
nLoss = nATRMultip * xATR
xATRTrailingStop = iff(close > nz(xATRTrailingStop[1], 0) and close[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), close - nLoss),
iff(close < nz(xATRTrailingStop[1], 0) and close[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), close + nLoss),
iff(close > nz(xATRTrailingStop[1], 0), close - nLoss, close + nLoss)))
pos = iff(close[1] < nz(xATRTrailingStop[1], 0) and close > nz(xATRTrailingStop[1], 0), 1,
iff(close[1] > nz(xATRTrailingStop[1], 0) and close < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0)))
color = pos == -1 ? red: pos == 1 ? green : blue
plot(xATRTrailingStop, color=color, title="ATR Trailing Stop")
===============================================
작성해주신 수식
input : nATRPeriod(5);
input : nATRMultip(3.5);
var : xATR(0),nLoss(0),xATRTrailingStop(0),ps(0),nz(0),color(0);
xATR = atr(nATRPeriod);
nLoss = nATRMultip * xATR;
nz = iff(xATRTrailingStop[1] == true,0,xATRTrailingStop[1]);
xATRTrailingStop = iff(close > nz and close[1] > nz, max(nz, close - nLoss),
iff(close < nz and close[1] < nz, min(nz, close + nLoss),
iff(close > nz, close - nLoss, close + nLoss)));
ps = iff(close[1] < nz and close > nz, 1,
iff(close[1] > nz and close < nz, -1, iff(isnan(ps[1]) ==true, 0,ps[1]))) ;
color = iff(ps == -1 , red, iff(ps == 1 , green , blue));
plot1(xATRTrailingStop, "ATR Trailing Stop",color);
==================
항상 감사드립니다. 수고하세요!!!
2025-05-09
529
글번호 190682