커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1643
글번호 230811
답변완료
재문의 드립니다.
첨부 파일에 나오는 선처럼, 두 선만 나오면 되는데요,
그 부분만 안될까요?
답변 항상 감사드립니다.
안녕하세요
예스스탁입니다.
올려주신 내용은 저희가 변환해 드리기 어렵습니다.
업무상 일정시간이상 요구되는 내용은 저희가 답변을 드리기 어렵습니다.
또한 해당 언어에 능숙하지 않아 내용파악하는데 시간이 많이 소모되어
해당 언어는 간단한 내용이 아니면 변경해 드리기 어렵습니다.
도움을 드리지 못해 죄송합니다.
즐거운 하루되세요
> alltoone 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 아래 트레이딩 뷰 지표식을 전환 부탁드립니다.
시스템 식도 들어 있는 듯 한데, 그냥 지표식만 가능하시면 부탁드려요.
감사합니다.
study(title="MA Ribbon R5.2 by JustUncleL", shorttitle="MA_RIBBON R5.2", overlay = true)
// Use Alternate Anchor TF for MAs
anchor = input(0,minval=0,title="Set to an Anchor TimeFrame in mins (0=none, 1D=1440, 1W=7200)")
showRibbon = input(false, title="Show Ribbon If Chart TF Greater Than Anchor TF")
// Fast MA - type, length
fastType = input(defval="EMA", title="Fast MA Type: ", options=["SMA", "EMA", "WMA", "VWMA", "SMMA", "DEMA", "TEMA", "LAGMA", "LINREG", "HullMA", "ZEMA", "TMA", "SSMA"])
fastLen = input(defval=50, title="Fast MA - Length", minval=1)
fastGamma = input(defval=0.33,title="Fast MA - Gamma for LAGMA")
// Medium MA - type, length
mediumType = input(defval="EMA", title="Medium MA Type: ", options=["SMA", "EMA", "WMA", "VWMA", "SMMA", "DEMA", "TEMA", "LAGMA", "LINREG","HullMA", "ZEMA", "TMA", "SSMA"])
mediumLen = input(defval=1, title="Medium MA - Length (1=disabled)", minval=1)
mediumGamma = input(defval=0.55,title="Medium MA - Gamma for LAGMA")
// Slow MA - type, length
slowType = input(defval="EMA", title="Slow MA Type: ", options=["SMA", "EMA", "WMA", "VWMA", "SMMA", "DEMA", "TEMA", "LAGMA", "LINREG", "HullMA", "ZEMA", "TMA", "SSMA"])
slowLen = input(defval=100, title="Slow MA - Length", minval=2)
slowGamma = input(defval=0.77,title="Slow MA - Gamma for LAGMA")
//
ma_src = input(close,title="MA Source")
sBars = input(false,title="Show Coloured Bars")
uGrabClr= input(false,title="Use Grab Bar 6-tone Colours, instead of Standard 3-tone")
uOpen = input(false,title="Candles must open and close outside ribbon Colouring" )
//
ShowMACross = input(false,title="Show MA Cross Alerts")
//
ShowSwing = input(false,title="Show Swing Alerts")
rFilter = input(false,title="Filter Swing Alerts to Ribbon Colour")
dFilter = input(false,title="Filter Swing Alerts to Fast MA Directional Slope")
//
// - INPUTS END
// Constants colours that include fully non-transparent option.
green100 = #008000FF
lime100 = #00FF00FF
red100 = #FF0000FF
blue100 = #0000FFFF
aqua100 = #00FFFFFF
darkred100 = #8B0000FF
gray100 = #808080FF
// - FUNCTIONS
// - variant(type, src, len, gamma)
// Returns MA input sellection variant, default to SMA if blank or typo.
// SuperSmoother filter
// © 2013 John F. Ehlers
variant_supersmoother(src,len) =>
a1 = exp(-1.414*3.14159 / len)
b1 = 2*a1*cos(1.414*3.14159 / len)
c2 = b1
c3 = (-a1)*a1
c1 = 1 - c2 - c3
v9 = 0.0
v9 := c1*(src + nz(src[1])) / 2 + c2*nz(v9[1]) + c3*nz(v9[2])
v9
variant_smoothed(src,len) =>
v5 = 0.0
v5 := na(v5[1]) ? sma(src, len) : (v5[1] * (len - 1) + src) / len
v5
variant_zerolagema(src,len) =>
xLag = (len - 1) / 2
xEMA = (src + (src - src[xLag]))
v10 = ema(xEMA, len)
v10
variant_doubleema(src,len) =>
v2 = ema(src, len)
v6 = 2 * v2 - ema(v2, len)
v6
variant_tripleema(src,len) =>
v2 = ema(src, len)
v7 = 3 * (v2 - ema(v2, len)) + ema(ema(v2, len), len) // Triple Exponential
v7
//calc Laguerre
variant_lag(p,g) =>
L0 = 0.0
L1 = 0.0
L2 = 0.0
L3 = 0.0
L0 := (1 - g)*p+g*nz(L0[1])
L1 := -g*L0+nz(L0[1])+g*nz(L1[1])
L2 := -g*L1+nz(L1[1])+g*nz(L2[1])
L3 := -g*L2+nz(L2[1])+g*nz(L3[1])
f = (L0 + 2*L1 + 2*L2 + L3)/6
f
// return variant, defaults to SMA
variant(type, src, len, g) =>
result = src
if len>1
result := type=="EMA" ? ema(src,len) :
type=="WMA" ? wma(src,len):
type=="VWMA" ? vwma(src,len) :
type=="SMMA" ? variant_smoothed(src,len) :
type=="DEMA" ? variant_doubleema(src,len):
type=="TEMA" ? variant_tripleema(src,len):
type=="LAGMA" ? variant_lag(src,g) :
type=="LINREG"? linreg(src,len,0) :
type=="HullMA"? wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len))) :
type=="SSMA" ? variant_supersmoother(src,len) :
type=="ZEMA" ? variant_zerolagema(src,len) :
type=="TMA" ? sma(sma(src,len),len) :
sma(src,len)
//end if
result
// - /variant
// - FUNCTIONS END
// Make sure we have minimum channel spread.
LengthSlow_ = slowLen //fastType==slowType?(slowLen-slowLen)<1?slowLen+1:slowLen : slowLen
//what is the 1st Anchor (normally current chart TF)
currentTFmins = isintraday ? interval : isdaily ? interval*1440 : isweekly ? interval*7200 : ismonthly ? interval*30240 : interval
// function to caculate multiplier from anchor time frame (TF is in mins)
multAnchor(anchor) =>
mult = 1
if isintraday
mult := anchor>0 ? (interval<=0 ? 1 : interval>=anchor? 1 : round(anchor/interval)) : 1
else
mult := anchor>0 ? isdaily ? (anchor<=1440 ? 1 : round(anchor/1440)) :
isweekly ? (anchor<=7200 ? 1 : round(anchor/7200)) :
ismonthly ? (anchor<=30240 ? 1 : round(anchor/30240)) : 1 : 1
//end if
mult
// get multipliers for each time frame
mult = multAnchor(anchor)
// Adjust MA lengths with Anchor multiplier
LengthFast = mult==1 ? fastLen : (fastLen*mult)
LengthMedium = mult==1 ? mediumLen : (mediumLen*mult)
LengthSlow = mult==1 ? LengthSlow_ : (LengthSlow_*mult)
//plotshape(interval,location=location.bottom)
// Get the two MAs
fastMA = variant(fastType,ma_src, LengthFast, fastGamma)
slowMA = variant(slowType,ma_src, LengthSlow, slowGamma)
mediumMA = mediumLen==1 ? na : variant(mediumType,ma_src, LengthMedium, mediumGamma)
showRibbonFlag = showRibbon or anchor==0 or currentTFmins<=anchor
fDirection = 0
sDirection = 0
//mDirection = 0
fDirection := hlc3 > fastMA ? 1 : hlc3 < fastMA ? -1 : nz(fDirection[1],1)
sDirection := hlc3 > slowMA ? 1 : hlc3 < slowMA ? -1 : nz(sDirection[1],1)
//mDirection := LengthMedium==1 ? na : hlc3 > mediumMA ? 1 : hlc3 < mediumMA ? -1 : nz(mDirection[1],1)
//Plot the Ribbon
fastMA_=plot( showRibbonFlag?fastMA:na,color=fDirection==1?green:red,style=line,join=true,linewidth=1,transp=20,title="Fast MA")
slowMA_=plot( showRibbonFlag?slowMA:na,color=sDirection==1?green:red,style=line,join=true,linewidth=1,transp=20,title="Slow MA")
plot( showRibbonFlag?mediumMA:na,color=sDirection==1?green:red,style=circles,join=true,linewidth=1,transp=20,title="Medium MA")
fcolor = fastMA>slowMA?green:red
fill(fastMA_,slowMA_,color=fcolor,transp=80,title="Ribbon Fill")
// Colour bars according to the close position relative to the MA sellected
// Or Grab candle colour code bars according to the close position relative to the MA sellected
grabcol = uGrabClr? close>=open? hlc3>fastMA and hlc3>slowMA and (not uOpen or (open>fastMA and open>slowMA))? lime100 :
hlc3<fastMA and hlc3<slowMA and (not uOpen or (open<fastMA and open<slowMA))? red100 : aqua100 :
hlc3>fastMA and hlc3>slowMA and (not uOpen or (open>fastMA and open>slowMA))? green100 :
hlc3<fastMA and hlc3<slowMA and (not uOpen or (open<fastMA and open<slowMA))? darkred100 : blue100 : na
grabcol := uGrabClr? grabcol : hlc3>fastMA and hlc3>slowMA and (not uOpen or (open>fastMA and open>slowMA))? lime100 :
hlc3<fastMA and hlc3<slowMA and (not uOpen or (open<fastMA and open<slowMA))? red100 : gray100
barcolor(showRibbonFlag and sBars and not ShowMACross?grabcol:na, title = "Bar Colours")
// Generate Alert Arrows
//
buy = 0
sell=0
buyT = 0
sellT =0
// Generate signal by Candle Colour
buy := grabcol==lime100 or grabcol==green100? (nz(buy[1])+1) : 0
sell := grabcol==red100 or grabcol==darkred100? (nz(sell[1])+1) : 0
// Trend Filter
buyT := buy==0? 0 : (rFilter and fastMA<slowMA) or (dFilter and falling(fastMA,2))? 0 : nz(buyT[1])+1
sellT := sell==0? 0 : (rFilter and fastMA>slowMA) or (dFilter and rising(fastMA,2))? 0 : nz(sellT[1])+1
// Exit conditions
exitbuy = nz(buyT[1])>0 and buyT==0
exitsell = nz(sellT[1])>0 and sellT==0
//
plotarrow(showRibbonFlag and ShowSwing and buyT==1 ?1:na, title="BUY Swing Arrow", colorup=lime, maxheight=60, minheight=50, transp=20)
plotarrow(showRibbonFlag and ShowSwing and sellT==1 ?-1:na, title="SELL Swing Arrow", colordown=red, maxheight=60, minheight=50, transp=20)
//
plotshape(showRibbonFlag and ShowSwing and exitbuy, title='BUY Exit', style=shape.xcross, location=location.belowbar, color=gray, text="Exit₩nBuy", offset=0,transp=0)
plotshape(showRibbonFlag and ShowSwing and exitsell, title='Sell Exit', style=shape.xcross, location=location.abovebar, color=gray, text="Exit₩nSell", offset=0,transp=0)
// MA trend bar color
TrendingUp = fastMA > slowMA
TrendingDown = fastMA < slowMA
barcolor(showRibbonFlag and sBars and ShowMACross? TrendingUp ? green : TrendingDown ? red : blue : na)
// MA cross alert
MAcrossing = cross(fastMA, slowMA) ? fastMA : na
plot(showRibbonFlag and ShowMACross? MAcrossing : na, style = cross, linewidth = 4,color=black)
// MA cross background color alert
Uptrend = TrendingUp and TrendingDown[1]
Downtrend = TrendingDown and TrendingUp[1]
bgcolor(showRibbonFlag and ShowMACross? Uptrend ? green : Downtrend ? red : na : na,transp=50)
// Buy and sell alert
XBuy = 0, XBuy := nz(XBuy[1])
XSell = 0, XSell := nz(XSell[1])
XBuy := TrendingUp and close > close[1] ? XBuy+1 : TrendingDown or XBuy==0? 0 : XBuy+1
XSell := TrendingDown and close < close[1] ? XSell+1 : TrendingUp or XSell==0? 0 : XSell+1
plotshape(showRibbonFlag and ShowMACross and XBuy==1? close: na, color=black, style=shape.triangleup, text="XBuy", location=location.bottom, size=size.small)
plotshape(showRibbonFlag and ShowMACross and XSell==1? close: na, color=black, style=shape.triangledown, text="XSell", location=location.top, size=size.small)
//
//plotshape(showRibbonFlag and ShowMACross and exitbuy, title='BUY Exit', style=shape.xcross, location=location.belowbar, color=gray, text="Exit₩nBuy", offset=0,transp=0)
//plotshape(showRibbonFlag and ShowMACross and exitsell, title='Sell Exit', style=shape.xcross, location=location.abovebar, color=gray, text="Exit₩nSell", offset=0,transp=0)
// Generate Alarms
alertcondition(showRibbonFlag and buyT==1,title="BUY Alert",message="BUY")
alertcondition(showRibbonFlag and sellT==1,title="SELL Alert",message="SELL")
alertcondition(showRibbonFlag and XBuy==1,title="X BUY Alert",message="X BUY")
alertcondition(showRibbonFlag and XSell==1,title="X SELL Alert",message="X SELL")
alertcondition(showRibbonFlag and exitbuy,title="BUY Exit Alert",message="ExitBuy")
alertcondition(showRibbonFlag and exitsell,title="SELL Exit Alert",message="ExitSell")
//eof
2022-09-29
1917
글번호 162624
행복사랑채 님에 의해서 삭제되었습니다.
2022-09-29
1
글번호 162618
답변완료
수식부탁드립니다
안녕하세요. 유튜브에서, 주봉이평, 월봉이평, 연봉이평을 일봉차트에
나타나게하는 수식을 보고 카움수식으로 따라만들어보았읍니다.
이수식을 예스수식으로 부탁드립니다. 늘 감사드립니다.
(1)요일(함수)
M=floor(D/100)%100;
YY=if((M+1-1)==1 or (M+1-1)==2, floor(D/10000)-1, floor(D/10000));
MM=if((M+1-1)==1, 13, if((M+1-1)==2, 14, M));
DD=D%100;
A=(DD+ floor((13*MM+8)/5) + floor(YY/400) + floor(YY/100)+ YY)%7+2;
if(A>7, A-7, A)
(2)주봉의 값을 일봉값으로 나타내기(n주)
A=요일(date);
Valuewhen(n, A(1)>A, C(1))
(3)월봉의값을 일봉값으로 나타내기 (n개월)
M=floor(date/100);
Valuewhen(n, M1=M(1), C(1));
(4)년봉의값을 일봉값으로 나타내기 (n년)
Y=floor(date/10000);
Valuewhen(n, Y1=Y(1), C(1));
2022-09-29
1104
글번호 162617
답변완료
확인 좀 부탁드립니다!
안녕하세요!
어제 만들어 주신 수식을 오늘 매매에 적용해보았는데 풋고와 풋저의 간격이 좀 이상한 것 같습니다!
수식을 한번 확인해 주시길 부탁드립니다!
그리고 선의 굵기와 색상을 외부변수로 바꿔 주시길 부탁드립니다!
항상 노고에 감사드립니다!
var : month(0,Data1),nday(0,Data1),week(0,Data1),h1(0,Data1),l1(0,Data1),h2(0,Data1),l2(0,Data1);
var : TL1(0,Data1),TL2(0,Data1),TL3(0,Data1),TL4(0,Data1);
var : TX1(0,Data1),TX2(0,Data1),TX3(0,Data1),TX4(0,Data1);
month = data1(int(date/100)-int(date/10000)*100);
nday = data1(date - int(date/100)*100);
Week = data1(DayOfWeek(date));
if data1(Index) == 0 or (Bdate != Bdate[1] and month%3 == 0 and nday >= 8 and nday <= 14 and week == 4) then
{
h1 = data1(h);
l1 = data1(l);
h2 = data2(h);
l2 = data2(l);
}
Else
{
if h1 > 0 and data1(h) > h1 Then
{
h1 = data1(h);
}
if l1 > 0 and data1(l) < l1 Then
{
l1 = data1(l);
}
if h2 > 0 and data2(h) > h2 Then
{
h2 = data2(h);
}
if l2 > 0 and data2(l) < l2 Then
{
l2 = data1(l);
}
}
if CurrentDate == sDate Then
{
if Data1(sDate != sDate[1])Then
{
tl1 = TL_New(sDate,stime,h1,NextBarSdate,NextBarStime,h1);
TL_SetExtLeft(tl1,true);
TL_SetExtRight(tl1,true);
TL_SetColor(tl1,White);
tx1 = Text_New(sDate,stime,h1,"콜고");
Text_SetColor(tx1,White);
Text_SetStyle(tx1,0,1);
tl2 = TL_New(sDate,stime,l1,NextBarSdate,NextBarStime,l1);
TL_SetExtLeft(tl2,true);
TL_SetExtRight(tl2,true);
TL_SetColor(tl2,White);
tx2 = Text_New(sDate,stime,l1,"콜저");
Text_SetColor(tx2,White);
Text_SetStyle(tx2,0,1);
tl3 = TL_New(sDate,stime,h2,NextBarSdate,NextBarStime,h2);
TL_SetExtLeft(tl3,true);
TL_SetExtRight(tl3,true);
TL_SetColor(tl3,White);
tx3 = Text_New(sDate,stime,h2,"풋고");
Text_SetColor(tx3,White);
Text_SetStyle(tx3,0,1);
tl4 = TL_New(sDate,stime,l2,NextBarSdate,NextBarStime,l2);
TL_SetExtLeft(tl4,true);
TL_SetExtRight(tl4,true);
TL_SetColor(tl4,White);
tx4 = Text_New(sDate,stime,l2,"풋저");
Text_SetColor(tl4,White);
Text_SetStyle(tx4,0,1);
}
Else
{
TL_SetBegin(tl1,sDate,sTime,h1);
TL_SetEnd(tl1,NextBarSdate,NextBarStime,h1);
Text_SetLocation(tx1,NextBarSdate,NextBarStime,h1);
TL_SetBegin(tl2,sDate,sTime,l1);
TL_SetEnd(tl2,NextBarSdate,NextBarStime,l1);
Text_SetLocation(tx2,NextBarSdate,NextBarStime,l1);
TL_SetBegin(tl3,sDate,sTime,h2);
TL_SetEnd(tl3,NextBarSdate,NextBarStime,h2);
Text_SetLocation(tx3,NextBarSdate,NextBarStime,h2);
TL_SetBegin(tl4,sDate,sTime,l2);
TL_SetEnd(tl4,NextBarSdate,NextBarStime,l2);
Text_SetLocation(tx4,NextBarSdate,NextBarStime,l2);
}
}
2022-09-29
942
글번호 162614
답변완료
문의 드립니다.
아래 트레이딩 뷰 지표식을 전환 부탁드립니다.
시스템 식도 들어 있는 듯 한데, 그냥 지표식만 가능하시면 부탁드려요.
감사합니다.
study(title="MA Ribbon R5.2 by JustUncleL", shorttitle="MA_RIBBON R5.2", overlay = true)
// Use Alternate Anchor TF for MAs
anchor = input(0,minval=0,title="Set to an Anchor TimeFrame in mins (0=none, 1D=1440, 1W=7200)")
showRibbon = input(false, title="Show Ribbon If Chart TF Greater Than Anchor TF")
// Fast MA - type, length
fastType = input(defval="EMA", title="Fast MA Type: ", options=["SMA", "EMA", "WMA", "VWMA", "SMMA", "DEMA", "TEMA", "LAGMA", "LINREG", "HullMA", "ZEMA", "TMA", "SSMA"])
fastLen = input(defval=50, title="Fast MA - Length", minval=1)
fastGamma = input(defval=0.33,title="Fast MA - Gamma for LAGMA")
// Medium MA - type, length
mediumType = input(defval="EMA", title="Medium MA Type: ", options=["SMA", "EMA", "WMA", "VWMA", "SMMA", "DEMA", "TEMA", "LAGMA", "LINREG","HullMA", "ZEMA", "TMA", "SSMA"])
mediumLen = input(defval=1, title="Medium MA - Length (1=disabled)", minval=1)
mediumGamma = input(defval=0.55,title="Medium MA - Gamma for LAGMA")
// Slow MA - type, length
slowType = input(defval="EMA", title="Slow MA Type: ", options=["SMA", "EMA", "WMA", "VWMA", "SMMA", "DEMA", "TEMA", "LAGMA", "LINREG", "HullMA", "ZEMA", "TMA", "SSMA"])
slowLen = input(defval=100, title="Slow MA - Length", minval=2)
slowGamma = input(defval=0.77,title="Slow MA - Gamma for LAGMA")
//
ma_src = input(close,title="MA Source")
sBars = input(false,title="Show Coloured Bars")
uGrabClr= input(false,title="Use Grab Bar 6-tone Colours, instead of Standard 3-tone")
uOpen = input(false,title="Candles must open and close outside ribbon Colouring" )
//
ShowMACross = input(false,title="Show MA Cross Alerts")
//
ShowSwing = input(false,title="Show Swing Alerts")
rFilter = input(false,title="Filter Swing Alerts to Ribbon Colour")
dFilter = input(false,title="Filter Swing Alerts to Fast MA Directional Slope")
//
// - INPUTS END
// Constants colours that include fully non-transparent option.
green100 = #008000FF
lime100 = #00FF00FF
red100 = #FF0000FF
blue100 = #0000FFFF
aqua100 = #00FFFFFF
darkred100 = #8B0000FF
gray100 = #808080FF
// - FUNCTIONS
// - variant(type, src, len, gamma)
// Returns MA input sellection variant, default to SMA if blank or typo.
// SuperSmoother filter
// © 2013 John F. Ehlers
variant_supersmoother(src,len) =>
a1 = exp(-1.414*3.14159 / len)
b1 = 2*a1*cos(1.414*3.14159 / len)
c2 = b1
c3 = (-a1)*a1
c1 = 1 - c2 - c3
v9 = 0.0
v9 := c1*(src + nz(src[1])) / 2 + c2*nz(v9[1]) + c3*nz(v9[2])
v9
variant_smoothed(src,len) =>
v5 = 0.0
v5 := na(v5[1]) ? sma(src, len) : (v5[1] * (len - 1) + src) / len
v5
variant_zerolagema(src,len) =>
xLag = (len - 1) / 2
xEMA = (src + (src - src[xLag]))
v10 = ema(xEMA, len)
v10
variant_doubleema(src,len) =>
v2 = ema(src, len)
v6 = 2 * v2 - ema(v2, len)
v6
variant_tripleema(src,len) =>
v2 = ema(src, len)
v7 = 3 * (v2 - ema(v2, len)) + ema(ema(v2, len), len) // Triple Exponential
v7
//calc Laguerre
variant_lag(p,g) =>
L0 = 0.0
L1 = 0.0
L2 = 0.0
L3 = 0.0
L0 := (1 - g)*p+g*nz(L0[1])
L1 := -g*L0+nz(L0[1])+g*nz(L1[1])
L2 := -g*L1+nz(L1[1])+g*nz(L2[1])
L3 := -g*L2+nz(L2[1])+g*nz(L3[1])
f = (L0 + 2*L1 + 2*L2 + L3)/6
f
// return variant, defaults to SMA
variant(type, src, len, g) =>
result = src
if len>1
result := type=="EMA" ? ema(src,len) :
type=="WMA" ? wma(src,len):
type=="VWMA" ? vwma(src,len) :
type=="SMMA" ? variant_smoothed(src,len) :
type=="DEMA" ? variant_doubleema(src,len):
type=="TEMA" ? variant_tripleema(src,len):
type=="LAGMA" ? variant_lag(src,g) :
type=="LINREG"? linreg(src,len,0) :
type=="HullMA"? wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len))) :
type=="SSMA" ? variant_supersmoother(src,len) :
type=="ZEMA" ? variant_zerolagema(src,len) :
type=="TMA" ? sma(sma(src,len),len) :
sma(src,len)
//end if
result
// - /variant
// - FUNCTIONS END
// Make sure we have minimum channel spread.
LengthSlow_ = slowLen //fastType==slowType?(slowLen-slowLen)<1?slowLen+1:slowLen : slowLen
//what is the 1st Anchor (normally current chart TF)
currentTFmins = isintraday ? interval : isdaily ? interval*1440 : isweekly ? interval*7200 : ismonthly ? interval*30240 : interval
// function to caculate multiplier from anchor time frame (TF is in mins)
multAnchor(anchor) =>
mult = 1
if isintraday
mult := anchor>0 ? (interval<=0 ? 1 : interval>=anchor? 1 : round(anchor/interval)) : 1
else
mult := anchor>0 ? isdaily ? (anchor<=1440 ? 1 : round(anchor/1440)) :
isweekly ? (anchor<=7200 ? 1 : round(anchor/7200)) :
ismonthly ? (anchor<=30240 ? 1 : round(anchor/30240)) : 1 : 1
//end if
mult
// get multipliers for each time frame
mult = multAnchor(anchor)
// Adjust MA lengths with Anchor multiplier
LengthFast = mult==1 ? fastLen : (fastLen*mult)
LengthMedium = mult==1 ? mediumLen : (mediumLen*mult)
LengthSlow = mult==1 ? LengthSlow_ : (LengthSlow_*mult)
//plotshape(interval,location=location.bottom)
// Get the two MAs
fastMA = variant(fastType,ma_src, LengthFast, fastGamma)
slowMA = variant(slowType,ma_src, LengthSlow, slowGamma)
mediumMA = mediumLen==1 ? na : variant(mediumType,ma_src, LengthMedium, mediumGamma)
showRibbonFlag = showRibbon or anchor==0 or currentTFmins<=anchor
fDirection = 0
sDirection = 0
//mDirection = 0
fDirection := hlc3 > fastMA ? 1 : hlc3 < fastMA ? -1 : nz(fDirection[1],1)
sDirection := hlc3 > slowMA ? 1 : hlc3 < slowMA ? -1 : nz(sDirection[1],1)
//mDirection := LengthMedium==1 ? na : hlc3 > mediumMA ? 1 : hlc3 < mediumMA ? -1 : nz(mDirection[1],1)
//Plot the Ribbon
fastMA_=plot( showRibbonFlag?fastMA:na,color=fDirection==1?green:red,style=line,join=true,linewidth=1,transp=20,title="Fast MA")
slowMA_=plot( showRibbonFlag?slowMA:na,color=sDirection==1?green:red,style=line,join=true,linewidth=1,transp=20,title="Slow MA")
plot( showRibbonFlag?mediumMA:na,color=sDirection==1?green:red,style=circles,join=true,linewidth=1,transp=20,title="Medium MA")
fcolor = fastMA>slowMA?green:red
fill(fastMA_,slowMA_,color=fcolor,transp=80,title="Ribbon Fill")
// Colour bars according to the close position relative to the MA sellected
// Or Grab candle colour code bars according to the close position relative to the MA sellected
grabcol = uGrabClr? close>=open? hlc3>fastMA and hlc3>slowMA and (not uOpen or (open>fastMA and open>slowMA))? lime100 :
hlc3<fastMA and hlc3<slowMA and (not uOpen or (open<fastMA and open<slowMA))? red100 : aqua100 :
hlc3>fastMA and hlc3>slowMA and (not uOpen or (open>fastMA and open>slowMA))? green100 :
hlc3<fastMA and hlc3<slowMA and (not uOpen or (open<fastMA and open<slowMA))? darkred100 : blue100 : na
grabcol := uGrabClr? grabcol : hlc3>fastMA and hlc3>slowMA and (not uOpen or (open>fastMA and open>slowMA))? lime100 :
hlc3<fastMA and hlc3<slowMA and (not uOpen or (open<fastMA and open<slowMA))? red100 : gray100
barcolor(showRibbonFlag and sBars and not ShowMACross?grabcol:na, title = "Bar Colours")
// Generate Alert Arrows
//
buy = 0
sell=0
buyT = 0
sellT =0
// Generate signal by Candle Colour
buy := grabcol==lime100 or grabcol==green100? (nz(buy[1])+1) : 0
sell := grabcol==red100 or grabcol==darkred100? (nz(sell[1])+1) : 0
// Trend Filter
buyT := buy==0? 0 : (rFilter and fastMA<slowMA) or (dFilter and falling(fastMA,2))? 0 : nz(buyT[1])+1
sellT := sell==0? 0 : (rFilter and fastMA>slowMA) or (dFilter and rising(fastMA,2))? 0 : nz(sellT[1])+1
// Exit conditions
exitbuy = nz(buyT[1])>0 and buyT==0
exitsell = nz(sellT[1])>0 and sellT==0
//
plotarrow(showRibbonFlag and ShowSwing and buyT==1 ?1:na, title="BUY Swing Arrow", colorup=lime, maxheight=60, minheight=50, transp=20)
plotarrow(showRibbonFlag and ShowSwing and sellT==1 ?-1:na, title="SELL Swing Arrow", colordown=red, maxheight=60, minheight=50, transp=20)
//
plotshape(showRibbonFlag and ShowSwing and exitbuy, title='BUY Exit', style=shape.xcross, location=location.belowbar, color=gray, text="Exit₩nBuy", offset=0,transp=0)
plotshape(showRibbonFlag and ShowSwing and exitsell, title='Sell Exit', style=shape.xcross, location=location.abovebar, color=gray, text="Exit₩nSell", offset=0,transp=0)
// MA trend bar color
TrendingUp = fastMA > slowMA
TrendingDown = fastMA < slowMA
barcolor(showRibbonFlag and sBars and ShowMACross? TrendingUp ? green : TrendingDown ? red : blue : na)
// MA cross alert
MAcrossing = cross(fastMA, slowMA) ? fastMA : na
plot(showRibbonFlag and ShowMACross? MAcrossing : na, style = cross, linewidth = 4,color=black)
// MA cross background color alert
Uptrend = TrendingUp and TrendingDown[1]
Downtrend = TrendingDown and TrendingUp[1]
bgcolor(showRibbonFlag and ShowMACross? Uptrend ? green : Downtrend ? red : na : na,transp=50)
// Buy and sell alert
XBuy = 0, XBuy := nz(XBuy[1])
XSell = 0, XSell := nz(XSell[1])
XBuy := TrendingUp and close > close[1] ? XBuy+1 : TrendingDown or XBuy==0? 0 : XBuy+1
XSell := TrendingDown and close < close[1] ? XSell+1 : TrendingUp or XSell==0? 0 : XSell+1
plotshape(showRibbonFlag and ShowMACross and XBuy==1? close: na, color=black, style=shape.triangleup, text="XBuy", location=location.bottom, size=size.small)
plotshape(showRibbonFlag and ShowMACross and XSell==1? close: na, color=black, style=shape.triangledown, text="XSell", location=location.top, size=size.small)
//
//plotshape(showRibbonFlag and ShowMACross and exitbuy, title='BUY Exit', style=shape.xcross, location=location.belowbar, color=gray, text="Exit₩nBuy", offset=0,transp=0)
//plotshape(showRibbonFlag and ShowMACross and exitsell, title='Sell Exit', style=shape.xcross, location=location.abovebar, color=gray, text="Exit₩nSell", offset=0,transp=0)
// Generate Alarms
alertcondition(showRibbonFlag and buyT==1,title="BUY Alert",message="BUY")
alertcondition(showRibbonFlag and sellT==1,title="SELL Alert",message="SELL")
alertcondition(showRibbonFlag and XBuy==1,title="X BUY Alert",message="X BUY")
alertcondition(showRibbonFlag and XSell==1,title="X SELL Alert",message="X SELL")
alertcondition(showRibbonFlag and exitbuy,title="BUY Exit Alert",message="ExitBuy")
alertcondition(showRibbonFlag and exitsell,title="SELL Exit Alert",message="ExitSell")
//eof
2022-09-29
1417
글번호 162605
답변완료
재문의 드립니다
안녕하세요!
아래 78971번 문의내용관련 추가질문입니다
답변주신 수식으로 적용해본 결과 원본수식과 같은선이 출력되는것같습니다
무엇이 문제인지 수고스러우시겠지만 한번만더 검토 부탁드리겠습니다
감사합니다!!!
2022-09-29
983
글번호 162604
답변완료
지표 질문입니다
파라볼릭이 양전환될때 이전 두번의 양전환시 바닥 극점과 천정 극점 사이 상승폭을 더한 폭을 현재 바닥 극점을 기준으로 표시한다
파라볼릭이 음전환될때 이전 두번의 음전환시 천정 극점과 바닥 극점 사이 하락폭을 더한 폭을 현재 천정 극점을 기준으로 표시한다
파라볼릭이 전일과 연속일 경우, 당일부터 시작되는 두 가지 경우로 구분 부탁드립니다
감사합니다
2022-09-29
1107
글번호 162603
답변완료
수식 문의 드립니다
일봉매매에서 시가가 전일종가보다 낮고 -100틱 매수후 +200틱 청산의 수식어를 부탁드립니다.
2022-09-29
1069
글번호 162602
답변완료
시스템 수식 도움 부탁드립니다.
if CrossUp(C, DayHigh(1)) and
DayOpen >= DayClose(1)*0.985 and DayOpen <= DayClose(1)*1.045 and
C >= 1000 and C <= 100000 Then
buy();
위의 작성해주신 매매수식으로 실행했을 때 신호가격으로 매수가 되지 않고 해당 캔들의
종가로 매매가 됩니다. 시스템매매 설정에서 첨부파일과 같이 설정해도 종가매수가 됩니다. 신호가격 매수를 하려면 어떻게 해야 할까요?
2022-09-29
909
글번호 162596