커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1526
글번호 230811
답변완료
봉 길이 표시
수고 많습니다.
봉의 길이를 시가 와 종가를 기준(꼬리는 제외)으로 몸통의 길이를 1은 제외하고 첨부 그림처럼 양봉은 적색, 음봉은 파란색 숫자로 표기 부탁드립니다.
수고하세요.
2025-09-14
197
글번호 193986
답변완료
이동평균 음영표시
수고 많으십니다.
가격 이동평균선의 증감율을 가지고 차트에 음영을 표시하고 싶은데 가능한지요?
첨부 파일은 코스피 국내선물 2025.09.12. 15시 04분 120틱 20선 이동평균입니다.
20일선 이동평균선의 증감율(10,000분율)이
증가율(상승추세) 0.3 이상은 RED, 감소율(하락추세) 0.3이상은 BLUE, 그 외의 증감율에
대해서는 무표시 또는 LIME색상으로 차트에 음영으로 표시가 되도록 만들어 주시면 감사하겠습니다.
그리고 모든 값은 변경 가능하게 변수로 부탁드립니다.
만분율의 계산은(최종수치-최초수치/최초수치)*10,000 으로 계산한 값입니다.
신속한 답변에 항상 감사드립니다.
수고하세요.
2025-09-14
209
글번호 193985
답변완료
간단한건데 부탁드립니다.주봉,월봉기준
주봉과 월봉을 기준으로 하며
1.금번봉의 고가가 직전봉의 종가보다 2% 미만인 경우 챠트에 표시되게끔(=강세약세 등 화면으로) 수식을 부탁드립니다.
감사하고 미안합니다.
2025-09-14
232
글번호 193984
답변완료
종목 검색식 부탁드립니다
안녕하세요
3분봉에서 시초가 첫양봉인데 어제 종가보다 높은 양봉이며 두번째봉은 시초가 첫 양봉보다 높은 양봉인 종목 검색식 부탁드립니다
감사합니다
2025-09-13
201
글번호 193983
답변완료
부탁드립니다 항상 감사합니다
{==========================================
Disparity Index + RSI (YesLanguage version)
- DI = 100 * (src - SMA(src,L)) / SMA(src,L)
- scaledDI = 20 * DI + 50
- RSI = Wilder RMA
- RSI MA/BB 옵션: 0=None, 1=SMA, 2=SMA+BB, 3=EMA, 4=RMA, 5=WMA, 6=VWMA
- Regular Bullish/Bearish Divergence (라벨)
==========================================}
{----------- Inputs -----------}
input: DI_Length(14);
input: DI_Source(1); { 1=Close, 2=Open, 3=High, 4=Low, 5=Typical(H+L+C)/3 }
input: RSI_Length(14);
{ RSI Smoothing / BB }
input: MA_Type(1); { 0=None, 1=SMA, 2=SMA+BB, 3=EMA, 4=RMA, 5=WMA, 6=VWMA }
input: MA_Len(14);
input: BB_Mult(2.0);
{ Divergence }
input: CalcDivergence(false);
input: LB_Left(5);
input: LB_Right(5);
input: RangeLower(5);
input: RangeUpper(60);
{ Colors }
input: DiUpColor(RGB(14,187,35)); { ≈ #0ebb23 }
input: DiDnColor(Red);
input: LevelColor(Gray);
input: RsiColor(RGB(126,87,194)); { ≈ #7E57C2 }
input: BBColor(Green);
input: BullColor(Green);
input: BearColor(Red);
{----------- Vars -----------}
vars:
srcVal(0), smaDI(0), di(0), scaledDi(0),
chg(0), up(0), dn(0), upRMA(0), dnRMA(0), rsi(0),
rsiMA(0), rsiStDev(0), rsiBB_Up(0), rsiBB_Dn(0),
bullCond(false), bearCond(false),
rsiPivotLow(0), rsiPrevPivotLow(0), pxPivotLow(0), pxPrevPivotLow(0),
rsiPivotHigh(0), rsiPrevPivotHigh(0), pxPivotHigh(0), pxPrevPivotHigh(0),
pivBarsL(0), pivBarsH(0),
lblBull(0), lblBear(0);
{----------- Source 선택 -----------}
if DI_Source = 1 then
srcVal = Close
else if DI_Source = 2 then
srcVal = Open
else if DI_Source = 3 then
srcVal = High
else if DI_Source = 4 then
srcVal = Low
else
srcVal = (High + Low + Close) / 3;
{----------- Disparity Index -----------}
smaDI = Average(srcVal, DI_Length);
if smaDI <> 0 then
di = 100 * (srcVal - smaDI) / smaDI
else
di = 0;
scaledDi = 20 * di + 50;
{ 색상 }
vars: diColor(0);
if scaledDi >= 50 then diColor = DiUpColor else diColor = DiDnColor;
Plot1(scaledDi, "Scaled DI", diColor);
Plot2(50, "DI 50", LevelColor);
{----------- RSI (Wilder RMA) -----------}
chg = Close - Close[1];
up = MaxList(chg, 0);
dn = MaxList(-chg, 0);
if CurrentBar = 1 then begin
upRMA = up;
dnRMA = dn;
end else begin
upRMA = (upRMA[1] * (RSI_Length - 1) + up) / RSI_Length;
dnRMA = (dnRMA[1] * (RSI_Length - 1) + dn) / RSI_Length;
end;
if dnRMA = 0 then
rsi = 100
else if upRMA = 0 then
rsi = 0
else
rsi = 100 - (100 / (1 + upRMA / dnRMA));
Plot3(rsi, "RSI", RsiColor);
{ RSI 레벨 라인: 70/60/50/40/30 }
Plot4(70, "RSI 70", LevelColor);
Plot5(60, "RSI 60", LevelColor);
Plot6(50, "RSI 50", LevelColor);
Plot7(40, "RSI 40", LevelColor);
Plot8(30, "RSI 30", LevelColor);
{----------- RSI Smoothing / BB -----------}
{ MA_Type: 0=None, 1=SMA, 2=SMA+BB, 3=EMA, 4=RMA, 5=WMA, 6=VWMA }
if MA_Type = 1 or MA_Type = 2 then
rsiMA = Average(rsi, MA_Len)
else if MA_Type = 3 then
rsiMA = XAverage(rsi, MA_Len)
else if MA_Type = 4 then begin
if CurrentBar = 1 then rsiMA = rsi
else rsiMA = (rsiMA[1] * (MA_Len - 1) + rsi) / MA_Len;
end
else if MA_Type = 5 then
rsiMA = WAverage(rsi, MA_Len)
else if MA_Type = 6 then
rsiMA = Summation(rsi * Volume, MA_Len) / Summation(Volume, MA_Len)
else
rsiMA = 0;
if MA_Type >= 1 then
Plot9(rsiMA, "RSI_MA", Yellow);
if MA_Type = 2 then begin
rsiStDev = StdDev(rsi, MA_Len);
rsiBB_Up = rsiMA + rsiStDev * BB_Mult;
rsiBB_Dn = rsiMA - rsiStDev * BB_Mult;
Plot10(rsiBB_Up, "RSI_BB_Up", BBColor);
Plot11(rsiBB_Dn, "RSI_BB_Dn", BBColor);
end;
{----------- Regular Divergence -----------}
if CalcDivergence then begin
{ RSI Pivot Low }
if SwingLow(rsi, LB_Left, LB_Right, pivBarsL) then begin
rsiPivotLow = rsi[pivBarsL];
pxPivotLow = Low[LB_Right];
bullCond = (rsiPrevPivotLow <> 0) and (pxPrevPivotLow <> 0)
and (pxPivotLow < pxPrevPivotLow) { Price LL }
and (rsiPivotLow > rsiPrevPivotLow) { RSI HL }
and (pivBarsL >= RangeLower and pivBarsL <= RangeUpper);
if bullCond then begin
lblBull = Text_New(sDate[LB_Right], sTime[LB_Right], rsiPivotLow, " Bull ");
Text_SetStyle(lblBull, 2, 0);
Text_SetColor(lblBull, BullColor);
end;
rsiPrevPivotLow = rsiPivotLow;
pxPrevPivotLow = pxPivotLow;
end;
{ RSI Pivot High }
if SwingHigh(rsi, LB_Left, LB_Right, pivBarsH) then begin
rsiPivotHigh = rsi[pivBarsH];
pxPivotHigh = High[LB_Right];
bearCond = (rsiPrevPivotHigh <> 0) and (pxPrevPivotHigh <> 0)
and (pxPivotHigh > pxPrevPivotHigh) { Price HH }
and (rsiPivotHigh < rsiPrevPivotHigh) { RSI LH }
and (pivBarsH >= RangeLower and pivBarsH <= RangeUpper);
if bearCond then begin
lblBear = Text_New(sDate[LB_Right], sTime[LB_Right], rsiPivotHigh, " Bear ");
Text_SetStyle(lblBear, 2, 1);
Text_SetColor(lblBear, BearColor);
end;
rsiPrevPivotHigh = rsiPivotHigh;
pxPrevPivotHigh = pxPivotHigh;
end;
end;
수정부탁드립니다
2025-09-13
337
글번호 193982
답변완료
부탁드립니다 항상 감사합니다
//@version=6
indicator(title="Multiple Moving Averages & 3 Bollinger Bands", shorttitle="Multi MA & 3 BB", overlay=true)
​
// Function to calculate different types of Moving Averages
ma(source, length, type) =>
float result = na
switch type
"SMA" => result = ta.sma(source, length)
"EMA" => result = ta.ema(source, length)
"WMA" => result = ta.wma(source, length)
"RMA" => result = ta.rma(source, length)
"VWMA" => result = ta.vwma(source, length)
result
​
// --- Moving Average Settings ---
GRP_MA1 = "Moving Average 1"
ma1_enable = input.bool(true, "Enable MA 1", group=GRP_MA1)
ma1_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA1)
ma1_length = input.int(20, "Length", minval=1, group=GRP_MA1)
ma1_color = input.color(color.blue, "Color", group=GRP_MA1)
ma1 = ma(close, ma1_length, ma1_type)
plot(ma1_enable ? ma1 : na, title="MA 1", color=ma1_color, linewidth=2, display=display.all)
​
GRP_MA2 = "Moving Average 2"
ma2_enable = input.bool(true, "Enable MA 2", group=GRP_MA2)
ma2_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA2)
ma2_length = input.int(30, "Length", minval=1, group=GRP_MA2)
ma2_color = input.color(color.orange, "Color", group=GRP_MA2)
ma2 = ma(close, ma2_length, ma2_type)
plot(ma2_enable ? ma2 : na, title="MA 2", color=ma2_color, linewidth=2, display=display.all)
​
GRP_MA3 = "Moving Average 3"
ma3_enable = input.bool(true, "Enable MA 3", group=GRP_MA3)
ma3_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA3)
ma3_length = input.int(60, "Length", minval=1, group=GRP_MA3)
ma3_color = input.color(color.purple, "Color", group=GRP_MA3)
ma3 = ma(close, ma3_length, ma3_type)
plot(ma3_enable ? ma3 : na, title="MA 3", color=ma3_color, linewidth=2, display=display.all)
​
GRP_MA4 = "Moving Average 4"
ma4_enable = input.bool(false, "Enable MA 4", group=GRP_MA4)
ma4_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA4)
ma4_length = input.int(120, "Length", minval=1, group=GRP_MA4)
ma4_color = input.color(color.black, "Color", group=GRP_MA4)
ma4 = ma(close, ma4_length, ma4_type)
plot(ma4_enable ? ma4 : na, title="MA 4", color=ma4_color, linewidth=2, display=display.all)
​
GRP_MA5 = "Moving Average 5"
ma5_enable = input.bool(false, "Enable MA 5", group=GRP_MA5)
ma5_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA5)
ma5_length = input.int(240, "Length", minval=1, group=GRP_MA5)
ma5_color = input.color(color.new(color.green, 20), "Color", group=GRP_MA5)
ma5 = ma(close, ma5_length, ma5_type)
plot(ma5_enable ? ma5 : na, title="MA 5", color=ma5_color, linewidth=1, display=display.all)
​
GRP_MA6 = "Moving Average 6"
ma6_enable = input.bool(false, "Enable MA 6", group=GRP_MA6)
ma6_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA6)
ma6_length = input.int(400, "Length", minval=1, group=GRP_MA6)
ma6_color = input.color(color.new(color.red, 20), "Color", group=GRP_MA6)
ma6 = ma(close, ma6_length, ma6_type)
plot(ma6_enable ? ma6 : na, title="MA 6", color=ma6_color, linewidth=1, display=display.all)
​
GRP_MA7 = "Moving Average 7"
ma7_enable = input.bool(false, "Enable MA 7", group=GRP_MA7)
ma7_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA7)
ma7_length = input.int(600, "Length", minval=1, group=GRP_MA7)
ma7_color = input.color(color.new(color.teal, 20), "Color", group=GRP_MA7)
ma7 = ma(close, ma7_length, ma7_type)
plot(ma7_enable ? ma7 : na, title="MA 7", color=ma7_color, linewidth=1, display=display.all)
​
// --- Bollinger Bands Settings ---
// Bollinger Band 1
GRP_BB1 = "Bollinger Band 1"
bb1_enable = input.bool(true, "Enable BB 1", group=GRP_BB1)
bb1_source = input.source(close, "Source", group=GRP_BB1)
bb1_length = input.int(20, "Length", minval=1, group=GRP_BB1)
bb1_mult = input.float(2.0, "StdDev Mult", minval=0.001, maxval=50, step=0.1, group=GRP_BB1)
bb1_basis_color = input.color(color.aqua, "Basis Color", group=GRP_BB1) // Basis line color
bb1_upper_color = input.color(color.aqua, "Upper Color", group=GRP_BB1) // Upper line color
bb1_lower_color = input.color(color.aqua, "Lower Color", group=GRP_BB1) // Lower line color
bb1_linewidth = input.int(1, "Line Width", minval=1, maxval=4, group=GRP_BB1) // Line width for all BB lines
bb1_fill_color = input.color(color.new(color.aqua, 90), "Fill Color", group=GRP_BB1) // Fill color
bb1_hit_enable = input.bool(true, "Enable Hit Marks", group=GRP_BB1) // Enable/disable hit marks
bb1_hit_color_upper = input.color(color.red, "Upper Hit Color", group=GRP_BB1) // Color for upper band hit
bb1_hit_color_lower = input.color(color.green, "Lower Hit Color", group=GRP_BB1) // Color for lower band hit
​
bb1_basis = ta.sma(bb1_source, bb1_length)
bb1_dev = bb1_mult * ta.stdev(bb1_source, bb1_length)
bb1_upper = bb1_basis + bb1_dev
bb1_lower = bb1_basis - bb1_dev
​
plot(bb1_enable ? bb1_basis : na, "BB1 Basis", color=bb1_basis_color, linewidth=bb1_linewidth)
p1_bb1 = plot(bb1_enable ? bb1_upper : na, "BB1 Upper", color=bb1_upper_color, linewidth=bb1_linewidth)
p2_bb1 = plot(bb1_enable ? bb1_lower : na, "BB1 Lower", color=bb1_lower_color, linewidth=bb1_linewidth)
fill(p1_bb1, p2_bb1, color=bb1_enable ? bb1_fill_color : na, title="BB1 Fill")
​
// Plot shapes when candle hits BB1 (modified conditions to include equality)
plotshape(bb1_hit_enable and high >= bb1_upper, style=shape.triangledown, location=location.abovebar, color=bb1_hit_color_upper, size=size.small, title="BB1 Upper Hit")
plotshape(bb1_hit_enable and low <= bb1_lower, style=shape.triangleup, location=location.belowbar, color=bb1_hit_color_lower, size=size.small, title="BB1 Lower Hit")
​
​
// Bollinger Band 2
GRP_BB2 = "Bollinger Band 2"
bb2_enable = input.bool(false, "Enable BB 2", group=GRP_BB2)
bb2_source = input.source(open, "Source", group=GRP_BB2)
bb2_length = input.int(4, "Length", minval=1, group=GRP_BB2)
bb2_mult = input.float(4.0, "StdDev Mult", minval=0.001, maxval=50, step=0.1, group=GRP_BB2)
bb2_basis_color = input.color(color.fuchsia, "Basis Color", group=GRP_BB2) // Basis line color
bb2_upper_color = input.color(color.fuchsia, "Upper Color", group=GRP_BB2) // Upper line color
bb2_lower_color = input.color(color.fuchsia, "Lower Color", group=GRP_BB2) // Lower line color
bb2_linewidth = input.int(1, "Line Width", minval=1, maxval=4, group=GRP_BB2) // Line width for all BB lines
bb2_fill_color = input.color(color.new(color.fuchsia, 90), "Fill Color", group=GRP_BB2) // Fill color
bb2_hit_enable = input.bool(false, "Enable Hit Marks", group=GRP_BB2) // Enable/disable hit marks
bb2_hit_color_upper = input.color(color.red, "Upper Hit Color", group=GRP_BB2) // Color for upper band hit
bb2_hit_color_lower = input.color(color.green, "Lower Hit Color", group=GRP_BB2) // Color for lower band hit
​
bb2_basis = ta.sma(bb2_source, bb2_length)
bb2_dev = bb2_mult * ta.stdev(bb2_source, bb2_length)
bb2_upper = bb2_basis + bb2_dev
bb2_lower = bb2_basis - bb2_dev
​
plot(bb2_enable ? bb2_basis : na, "BB2 Basis", color=bb2_basis_color, linewidth=bb2_linewidth)
p1_bb2 = plot(bb2_enable ? bb2_upper : na, "BB2 Upper", color=bb2_upper_color, linewidth=bb2_linewidth)
p2_bb2 = plot(bb2_enable ? bb2_lower : na, "BB2 Lower", color=bb2_lower_color, linewidth=bb2_linewidth)
fill(p1_bb2, p2_bb2, color=bb2_enable ? bb2_fill_color : na, title="BB2 Fill")
​
// Plot shapes when candle hits BB2 (modified conditions to include equality)
plotshape(bb2_hit_enable and high >= bb2_upper, style=shape.triangledown, location=location.abovebar, color=bb2_hit_color_upper, size=size.small, title="BB2 Upper Hit")
plotshape(bb2_hit_enable and low <= bb2_lower, style=shape.triangleup, location=location.belowbar, color=bb2_hit_color_lower, size=size.small, title="BB2 Lower Hit")
​
// Bollinger Band 3
GRP_BB3 = "Bollinger Band 3"
bb3_enable = input.bool(false, "Enable BB 3", group=GRP_BB3)
bb3_source = input.source(open, "Source", group=GRP_BB3)
bb3_length = input.int(3, "Length", minval=1, group=GRP_BB3)
bb3_mult = input.float(3.0, "StdDev Mult", minval=0.001, maxval=50, step=0.1, group=GRP_BB3)
bb3_basis_color = input.color(color.lime, "Basis Color", group=GRP_BB3) // Basis line color
bb3_upper_color = input.color(color.lime, "Upper Color", group=GRP_BB3) // Upper line color
bb3_lower_color = input.color(color.lime, "Lower Color", group=GRP_BB3) // Lower line color
bb3_linewidth = input.int(1, "Line Width", minval=1, maxval=4, group=GRP_BB3) // Line width for all BB lines
bb3_fill_color = input.color(color.new(color.lime, 90), "Fill Color", group=GRP_BB3) // Fill color
bb3_hit_enable = input.bool(false, "Enable Hit Marks", group=GRP_BB3) // Enable/disable hit marks
bb3_hit_color_upper = input.color(color.red, "Upper Hit Color", group=GRP_BB3) // Color for upper band hit
bb3_hit_color_lower = input.color(color.green, "Lower Hit Color", group=GRP_BB3) // Color for lower band hit
​
bb3_basis = ta.sma(bb3_source, bb3_length)
bb3_dev = bb3_mult * ta.stdev(bb3_source, bb3_length)
bb3_upper = bb3_basis + bb3_dev
bb3_lower = bb3_basis - bb3_dev
​
plot(bb3_enable ? bb3_basis : na, "BB3 Basis", color=bb3_basis_color, linewidth=bb3_linewidth)
p1_bb3 = plot(bb3_enable ? bb3_upper : na, "BB3 Upper", color=bb3_upper_color, linewidth=bb3_linewidth)
p2_bb3 = plot(bb3_enable ? bb3_lower : na, "BB3 Lower", color=bb3_lower_color, linewidth=bb3_linewidth)
fill(p1_bb3, p2_bb3, color=bb3_enable ? bb3_fill_color : na, title="BB3 Fill")
​
// Plot shapes when candle hits BB3 (modified conditions to include equality)
plotshape(bb3_hit_enable and high >= bb3_upper, style=shape.triangledown, location=location.abovebar, color=bb3_hit_color_upper, size=size.small, title="BB3 Upper Hit")
plotshape(bb3_hit_enable and low <= bb3_lower, style=shape.triangleup, location=location.belowbar, color=bb3_hit_color_lower, size=size.small, title="BB3 Lower Hit")
수정부탁드립니다
2025-09-13
321
글번호 193981
답변완료
부탁드립니다 항상 감사합니다
{==========================================
Disparity Index + RSI (YesLanguage ver.)
- DI = 100 * (src - SMA(src,L)) / SMA
- scaledDI = 20*DI + 50 (RSI 스케일과 유사)
- RSI = Wilder's RMA 방식
- RSI MA 옵션: None/SMA/BB/EMA/RMA/WMA/VWMA
- Regular Bullish/Bearish Divergence 라벨
==========================================}
{----------- Inputs -----------}
input : DI_Length(14);
input : RSI_Length(14);
input : MA_Type(1); { 0=None, 1=SMA, 2=SMA+BB, 3=EMA, 4=RMA, 5=WMA, 6=VWMA }
input : MA_Len(14);
input : BB_Mult(2.0);
input : CalcDivergence(true);
{ 색상(플랫폼 팔레트에 맞게 필요 시 바꾸세요) }
input : DiUpColor(Green), DiDnColor(Red);
input : RsiColor(Magenta);
input : BBColor(Green);
input : LevelColor(Gray);
{----------- Vars -----------}
var : src(0), di(0), scaledDi(0), smaDI(0);
var : rsi(0), chg(0), up(0), dn(0), upRMA(0), dnRMA(0);
var : rsiMA(0), rsiBB_up(0), rsiBB_dn(0), rsiStDev(0);
{ 다이버전스용 }
input : LB_Left(5), LB_Right(5);
var : rsiPivotLow(0), rsiPivL_Bars(0), rsiPrevPivotLow(0);
var : rsiPivotHigh(0), rsiPivH_Bars(0), rsiPrevPivotHigh(0);
var : pxPivotLow(0), pxPrevPivotLow(0);
var : pxPivotHigh(0), pxPrevPivotHigh(0);
var : bullCond(false), bearCond(false);
var : txBull(0), txBear(0);
{----------- Source -----------}
src = Close; { 필요 시 Open/High/Low 등으로 변경 가능 }
{----------- Disparity Index -----------}
smaDI = Average(src, DI_Length);
if smaDI <> 0 then
di = 100 * (src - smaDI) / smaDI
else
di = 0;
scaledDi = 20 * di + 50;
{ 색상 선택 }
var : diColor(0);
diColor = IFF(scaledDi >= 50, DiUpColor, DiDnColor);
Plot1(scaledDi, "Scaled DI", diColor); { DI(스케일드) }
Plot2(50, "DI 50", LevelColor); { Pine의 hline(50) 대체 }
{----------- RSI (Wilder RMA) -----------}
chg = Close - Close[1];
up = MaxList(chg, 0);
dn = MaxList(-chg, 0);
/* RMA 구현: prev*(Len-1)/Len + x/Len */
if CurrentBar = 1 then
begin
upRMA = up;
dnRMA = dn;
end
else
begin
upRMA = (upRMA[1] * (RSI_Length - 1) + up) / RSI_Length;
dnRMA = (dnRMA[1] * (RSI_Length - 1) + dn) / RSI_Length;
end;
if dnRMA = 0 then
rsi = 100
else if upRMA = 0 then
rsi = 0
else
rsi = 100 - (100 / (1 + upRMA / dnRMA));
Plot3(rsi, "RSI", RsiColor);
/* RSI 레벨 라인 (70/60/50/40/30) */
Plot4(70, "RSI 70", LevelColor);
Plot5(60, "RSI 60", LevelColor);
Plot6(50, "RSI 50", LevelColor);
Plot7(40, "RSI 40", LevelColor);
Plot8(30, "RSI 30", LevelColor);
{----------- RSI Smoothing MA / BB -----------}
/* MA 선택 함수 대체: 플랫폼 내장 MA가 다르면 Average/EMA/WMA 등으로 매핑하세요 */
{ SMA }
if MA_Type = 1 or MA_Type = 2 then
rsiMA = Average(rsi, MA_Len)
else if MA_Type = 3 then { EMA }
rsiMA = XAverage(rsi, MA_Len)
else if MA_Type = 4 then { RMA(=SMMA) }
begin
if CurrentBar = 1 then
rsiMA = rsi
else
rsiMA = (rsiMA[1] * (MA_Len - 1) + rsi) / MA_Len;
end
else if MA_Type = 5 then { WMA }
rsiMA = WAverage(rsi, MA_Len)
else if MA_Type = 6 then { VWMA (가중=거래량) }
rsiMA = Summation(rsi * Volume, MA_Len) / Summation(Volume, MA_Len)
else
rsiMA = NaN;
{ MA 표시 }
if MA_Type >= 1 then
Plot9(rsiMA, "RSI_MA", Yellow);
{ BB (SMA + Bollinger Bands) }
if MA_Type = 2 then
begin
rsiStDev = StandardDev(rsi, MA_Len, 1); { 1 = 표본/모수 선택은 환경 따라 조정 }
rsiBB_up = rsiMA + rs_
수정부탁드려요
2025-09-13
280
글번호 193980
답변완료
전략실행과 시뮬레이션의 차이?
변수값 최적화를 위해서 5분봉 챠트로 2/24~9/13일까지 시뮬레이션 챠트를 돌려보니 9/8~9/12일까지의 거래 내역이 전략실행 챠트에서는 있었으나 시뮬레이션 챠트에서는 나타나지 않는데 왜 그럴까요?
비교를 위해 두가지의 시스템 성능 보고서 캡쳐사진을 올립니다. 하나는 시뮬레이션 보고서이고 하나는 전략실행 보고서 입니다. 차이가 나는 이유를 설명해 주시면 고맙겠습니다.
2025-09-13
189
글번호 193979
답변완료
종목 검색식 부탁드립니다.
대금조건=거래대금>=10000;//기준봉의 거래대금은 100억
조건=Sum(대금조건,3)==3 &&
Sum(대금조건(3),20)==0;
가격라인=Valuewhen(1,조건,저가);
V라인=Valuewhen(1,조건,V);
CrossUp(C,가격라인) &&
CrossUp(V,V라인)
위의 수식을 예스랭귀지로 변환 부탁드립니다.
2025-09-12
246
글번호 193978