커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

실거래 문의 드립니다.

1.전략차트(일봉)에서 거래시 당일 종가 청산을 할 수 있는 방법이 있나요? setstopendofday(1520) 또는 setstopendofday(1525) 또는 setstopendofday(1515)가 일봉차트에서 실행시 구현이 가능한지가 궁금합니다. 실매매와 시뮬레이션의 차이는 관계 없이 청산이 되는지가 궁금해서 여줘봅니다. 2.일봉 차트에서 Buy("ENT",AtStop,ENTRY); 명령시 ENTRY값에 도달즉시 시장가로 매수가능한가요? 항상 감사합니다.
프로필 이미지
마녀58
2022-09-29
963
글번호 162629
시스템
답변완료

키움 후행스펜수식입다

shift(close,-midPeriod+1) 후행스펜 수식입니다 1 후행스펜 만 부탁드립니다 2, 26일 뒤에 생성되는 지표인데 현재위에 부탁드립니다 -26일 을 0일로 두가지 부탁드립니다
프로필 이미지
매치다는
2022-09-29
979
글번호 162628
지표
답변완료

설명부탁드립니다

고성 님의지표입니다 Input : shortPeriod(60), longPeriod(130), Period(30),val(-0.075),Value2(0.00); Var : MACDv(0), MACDsig(0),T(0),tl1(0),tl2(0),굵기(1); var : count(0); MACDv = MACD(shortPeriod, longPeriod); MACDsig = ma(MACDv,Period); if macdsig > macdsig [1] Then T = 1; if macdsig <macdsig [1] Then T = -1; Plot1(macdsig ,"macdsig ",IFF(T == 1,Red,Blue)); Plot2(-0.075); plot3(-0.1); PlotBaseLine1(0, "기준선1"); if CrossDown(MACDsig, val) Then { Condition1 = False; count = 0; } if T == 1 and T != T[1] and MACDsig <= val Then { Condition1 = true; TL1 = TL_New_Self(sDate,sTime,-999,sDate,sTime,99999); TL_SetColor(TL1,Magenta); TL_SetSize(TL1,6); TL1 = TL_New(sDate,sTime,-999,sDate,sTime,99999); TL_SetColor(TL1,Lime); TL_SetSize(TL1,1); } if T == -1 and T != T[1] and macdsig > Value2 Then { count = count+1; if count == 1 Then { TL2 = TL_New_Self(sDate,sTime,-999,sDate,sTime,99999); TL_SetColor(TL2,Blue); TL_SetSize(TL2,0.5); TL2 = TL_New(sDate,sTime,-999,sDate,sTime,99999); TL_SetColor(TL2,Blue); TL_SetSize(TL2,0.5); } }
프로필 이미지
매치다는
2022-09-29
964
글번호 162627
지표
답변완료

세로선

INPUTS: DEMAP(20),map(20); VARS : DEMA(0),mav(0),t(0); var1= EMA(C,DEMAP); value1= EMA(EMa(C,DEMAP),DEMAP); DEMA = var1 * 2 - value1; mav = ma(C,maP); if DEMA > mav Then T = 1; if DEMA < mav Then T = -1; Plot1(DEMA,"mav",IFF(T == 1,Red,Blue)); macd 시그널선이 "-0.075" 아래에서 양전환되어 상승중일때,상기 지표가 첫번째 양전환될 때 지표와 차트에 세로선. 상기 지표가 먼저 상승중에 macd 시그널선이 -0.075 아래에서 양전환되면, 상기지표가 음전환된 후 양전환될 때 세로선. 이후 두번째 양전환될 때나, macd 시그널선이 -0.075 위에서 양전환시는 무관. 두번째. 시스템. 세로선 발생시 매수,음전환시 매수청산. 감사합니다.
프로필 이미지
고성
2022-09-29
1167
글번호 162626
지표
답변완료

전일고점을 6101차트에 선으로 표시할 수 있을까요?

6101차트에 전일고가를 표시하고 싶습니다. 선으로 표시될 수 있으면 더 좋겠습니다. 어떻게 하면 될까요?
프로필 이미지
행복사랑채
2022-09-29
1024
글번호 162625
강조
답변완료

재문의 드립니다.

첨부 파일에 나오는 선처럼, 두 선만 나오면 되는데요, 그 부분만 안될까요? 답변 항상 감사드립니다. 안녕하세요 예스스탁입니다. 올려주신 내용은 저희가 변환해 드리기 어렵습니다. 업무상 일정시간이상 요구되는 내용은 저희가 답변을 드리기 어렵습니다. 또한 해당 언어에 능숙하지 않아 내용파악하는데 시간이 많이 소모되어 해당 언어는 간단한 내용이 아니면 변경해 드리기 어렵습니다. 도움을 드리지 못해 죄송합니다. 즐거운 하루되세요 > 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 // &#169; 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
프로필 이미지
alltoone
2022-09-29
1845
글번호 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
1055
글번호 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); } }
프로필 이미지
qha71
2022-09-29
913
글번호 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 // &#169; 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
프로필 이미지
alltoone
2022-09-29
1368
글번호 162605
지표