커뮤니티

트레이딩뷰 지표소스 검색식

프로필 이미지
귀족온달
2022-06-02 02:05:42
2209
글번호 159492
답변완료
트레이딩뷰 지표소스로 종목 검색식을 만들고 싶은데 가능할까요? 지표상 Buy 신호 종목 검색을 하고 싶습니다. //@version=3 study(title="ATR Smoothed (By dysrupt)_BuySell version", shorttitle="ATR_SM_BuySell", overlay = true) //Modifyed by @guikroth ////////////////////////////////////////////////////////////////////////////////INPUTS nATRPeriod = input(21, "Period") nATRMultip = input(6.3, "Multiplier",type=float, minval=0.5, maxval=1000, step=0.1) /////////////////////////////////////////////////////////////////////////////////ATR xATR = atr(nATRPeriod) nLoss = nATRMultip * xATR xATRTrailingStop = na 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 = na 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 ? lime : blue //patr=plot(xATRTrailingStop, color=color, linewidth=2, title="ATR Trailing Stop", transp=0) // Deternine if we are currently LONG isLong = false isLong := nz(isLong[1], false) // Determine if we are currently SHORT isShort = false isShort := nz(isShort[1], false) //Trading // Buy only if the buy signal is triggered and we are not already long LONG = not isLong and pos == 1 // Sell only if the sell signal is triggered and we are not already short SHORT = not isShort and pos == -1 if (LONG) isLong := true isShort := false if (SHORT) isLong := false isShort := true barcolor(isLong ? lime : isShort ? red : na) // Show Break Alerts plotshape(SHORT, title="Sell", style=shape.labeldown, location=location.abovebar, size=size.normal, text="Sell", transp=0, textcolor = white, color=red, transp=0) plotshape(LONG, title="Buy", style=shape.labelup, location=location.belowbar, size=size.normal, text="Buy", textcolor = white, color=green, transp=0) // === /PLOTTING === // Send alert to TV alarm sub-system alertcondition(LONG,title="Sell",message="Sell") alertcondition(SHORT,title="BuY",message="Buy") alertcondition(SHORT,title="BuY",message="Buy") alertcondition(SHORT,title="BuY",message="Buy") ////////////////////////////////////////////////////////////////////////////////VWMA len2 = input(100, minval=1, title="Smooth") src = input(close, title="Source") out = vwma(src, len2) avg1=avg(out, xATRTrailingStop) plot(avg1, color=aqua, transp=0, title="ATR")
종목검색
답변 4
프로필 이미지

예스스탁 예스스탁 답변

2022-06-02 16:34:06

안녕하세요 예스스탁입니다. 예스랭귀지는 수식의 종류별로 각각 작성해서 차트에 적용하셔야 합니다. 올리신 수식에는 강조식으로 작성될 내용, 시스템식으로 작성될 내용, 지표로 작성될 내용 총 3가지가 있습니다. 1 강조식 input : nATRPeriod(21),nATRMultip(6.3); var : xATR(0),nLoss(0),xATRTrailingStop(0),pos(0),color(0); var : isLong(False),isshort(False),LONG(False),Short(False); xATR = atr(nATRPeriod); nLoss = nATRMultip * xATR; xATRTrailingStop = iff(close > xATRTrailingStop and close[1] > xATRTrailingStop, max(xATRTrailingStop[1], close - nLoss), iff(close < xATRTrailingStop and close[1] < xATRTrailingStop, min(xATRTrailingStop[1], close + nLoss), iff(close > xATRTrailingStop, close - nLoss, close + nLoss))); if CrossUp(C,xATRTrailingStop) Then pos = 1; if CrossDown(C,xATRTrailingStop) Then pos = -1; LONG = pos != pos[1] and pos == 1; SHORT = pos != pos[1] and pos == -1; if LONG Then { isLong = true; isShort = false; } if SHORT Then { isLong = false; isShort = true; } PlotPaintBar(H,L,"강조", iff(isLong , lime , IFf( isShort , red , Nan))); 2 시스템식 input : nATRPeriod(21),nATRMultip(6.3); var : xATR(0),nLoss(0),xATRTrailingStop(0),pos(0),color(0); var : isLong(False),isshort(False),LONG(False),Short(False); xATR = atr(nATRPeriod); nLoss = nATRMultip * xATR; xATRTrailingStop = iff(close > xATRTrailingStop and close[1] > xATRTrailingStop, max(xATRTrailingStop[1], close - nLoss), iff(close < xATRTrailingStop and close[1] < xATRTrailingStop, min(xATRTrailingStop[1], close + nLoss), iff(close > xATRTrailingStop, close - nLoss, close + nLoss))); if CrossUp(C,xATRTrailingStop) Then pos = 1; if CrossDown(C,xATRTrailingStop) Then pos = -1; LONG = pos != pos[1] and pos == 1; SHORT = pos != pos[1] and pos == -1; if LONG Then { isLong = true; isShort = false; Buy("Buy"); } if SHORT Then { isLong = false; isShort = true; Sell("Sell"); } 3 지표식 inputs:len2(100); var: VolumeSum(0),VWMA(0); VolumeSum = AccumN( v, len2 ) ; VWMA = AccumN( C * v , len2 ) / len2 ; plot1(Vwma); 즐거운 하루되세요 > 귀족온달 님이 쓴 글입니다. > 제목 : 트레이딩뷰 지표소스 검색식 > 트레이딩뷰 지표소스로 종목 검색식을 만들고 싶은데 가능할까요? 지표상 Buy 신호 종목 검색을 하고 싶습니다. //@version=3 study(title="ATR Smoothed (By dysrupt)_BuySell version", shorttitle="ATR_SM_BuySell", overlay = true) //Modifyed by @guikroth ////////////////////////////////////////////////////////////////////////////////INPUTS nATRPeriod = input(21, "Period") nATRMultip = input(6.3, "Multiplier",type=float, minval=0.5, maxval=1000, step=0.1) /////////////////////////////////////////////////////////////////////////////////ATR xATR = atr(nATRPeriod) nLoss = nATRMultip * xATR xATRTrailingStop = na 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 = na 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 ? lime : blue //patr=plot(xATRTrailingStop, color=color, linewidth=2, title="ATR Trailing Stop", transp=0) // Deternine if we are currently LONG isLong = false isLong := nz(isLong[1], false) // Determine if we are currently SHORT isShort = false isShort := nz(isShort[1], false) //Trading // Buy only if the buy signal is triggered and we are not already long LONG = not isLong and pos == 1 // Sell only if the sell signal is triggered and we are not already short SHORT = not isShort and pos == -1 if (LONG) isLong := true isShort := false if (SHORT) isLong := false isShort := true barcolor(isLong ? lime : isShort ? red : na) // Show Break Alerts plotshape(SHORT, title="Sell", style=shape.labeldown, location=location.abovebar, size=size.normal, text="Sell", transp=0, textcolor = white, color=red, transp=0) plotshape(LONG, title="Buy", style=shape.labelup, location=location.belowbar, size=size.normal, text="Buy", textcolor = white, color=green, transp=0) // === /PLOTTING === // Send alert to TV alarm sub-system alertcondition(LONG,title="Sell",message="Sell") alertcondition(SHORT,title="BuY",message="Buy") alertcondition(SHORT,title="BuY",message="Buy") alertcondition(SHORT,title="BuY",message="Buy") ////////////////////////////////////////////////////////////////////////////////VWMA len2 = input(100, minval=1, title="Smooth") src = input(close, title="Source") out = vwma(src, len2) avg1=avg(out, xATRTrailingStop) plot(avg1, color=aqua, transp=0, title="ATR")
프로필 이미지

귀족온달

2022-06-02 16:42:25

감사합니다.고생해주셨는데.제가 무지해서 검색식을 만들가 없네요..ㅠ.ㅠ > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 트레이딩뷰 지표소스 검색식 > 안녕하세요 예스스탁입니다. 예스랭귀지는 수식의 종류별로 각각 작성해서 차트에 적용하셔야 합니다. 올리신 수식에는 강조식으로 작성될 내용, 시스템식으로 작성될 내용, 지표로 작성될 내용 총 3가지가 있습니다. 1 강조식 input : nATRPeriod(21),nATRMultip(6.3); var : xATR(0),nLoss(0),xATRTrailingStop(0),pos(0),color(0); var : isLong(False),isshort(False),LONG(False),Short(False); xATR = atr(nATRPeriod); nLoss = nATRMultip * xATR; xATRTrailingStop = iff(close > xATRTrailingStop and close[1] > xATRTrailingStop, max(xATRTrailingStop[1], close - nLoss), iff(close < xATRTrailingStop and close[1] < xATRTrailingStop, min(xATRTrailingStop[1], close + nLoss), iff(close > xATRTrailingStop, close - nLoss, close + nLoss))); if CrossUp(C,xATRTrailingStop) Then pos = 1; if CrossDown(C,xATRTrailingStop) Then pos = -1; LONG = pos != pos[1] and pos == 1; SHORT = pos != pos[1] and pos == -1; if LONG Then { isLong = true; isShort = false; } if SHORT Then { isLong = false; isShort = true; } PlotPaintBar(H,L,"강조", iff(isLong , lime , IFf( isShort , red , Nan))); 2 시스템식 input : nATRPeriod(21),nATRMultip(6.3); var : xATR(0),nLoss(0),xATRTrailingStop(0),pos(0),color(0); var : isLong(False),isshort(False),LONG(False),Short(False); xATR = atr(nATRPeriod); nLoss = nATRMultip * xATR; xATRTrailingStop = iff(close > xATRTrailingStop and close[1] > xATRTrailingStop, max(xATRTrailingStop[1], close - nLoss), iff(close < xATRTrailingStop and close[1] < xATRTrailingStop, min(xATRTrailingStop[1], close + nLoss), iff(close > xATRTrailingStop, close - nLoss, close + nLoss))); if CrossUp(C,xATRTrailingStop) Then pos = 1; if CrossDown(C,xATRTrailingStop) Then pos = -1; LONG = pos != pos[1] and pos == 1; SHORT = pos != pos[1] and pos == -1; if LONG Then { isLong = true; isShort = false; Buy("Buy"); } if SHORT Then { isLong = false; isShort = true; Sell("Sell"); } 3 지표식 inputs:len2(100); var: VolumeSum(0),VWMA(0); VolumeSum = AccumN( v, len2 ) ; VWMA = AccumN( C * v , len2 ) / len2 ; plot1(Vwma); 즐거운 하루되세요 > 귀족온달 님이 쓴 글입니다. > 제목 : 트레이딩뷰 지표소스 검색식 > 트레이딩뷰 지표소스로 종목 검색식을 만들고 싶은데 가능할까요? 지표상 Buy 신호 종목 검색을 하고 싶습니다. //@version=3 study(title="ATR Smoothed (By dysrupt)_BuySell version", shorttitle="ATR_SM_BuySell", overlay = true) //Modifyed by @guikroth ////////////////////////////////////////////////////////////////////////////////INPUTS nATRPeriod = input(21, "Period") nATRMultip = input(6.3, "Multiplier",type=float, minval=0.5, maxval=1000, step=0.1) /////////////////////////////////////////////////////////////////////////////////ATR xATR = atr(nATRPeriod) nLoss = nATRMultip * xATR xATRTrailingStop = na 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 = na 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 ? lime : blue //patr=plot(xATRTrailingStop, color=color, linewidth=2, title="ATR Trailing Stop", transp=0) // Deternine if we are currently LONG isLong = false isLong := nz(isLong[1], false) // Determine if we are currently SHORT isShort = false isShort := nz(isShort[1], false) //Trading // Buy only if the buy signal is triggered and we are not already long LONG = not isLong and pos == 1 // Sell only if the sell signal is triggered and we are not already short SHORT = not isShort and pos == -1 if (LONG) isLong := true isShort := false if (SHORT) isLong := false isShort := true barcolor(isLong ? lime : isShort ? red : na) // Show Break Alerts plotshape(SHORT, title="Sell", style=shape.labeldown, location=location.abovebar, size=size.normal, text="Sell", transp=0, textcolor = white, color=red, transp=0) plotshape(LONG, title="Buy", style=shape.labelup, location=location.belowbar, size=size.normal, text="Buy", textcolor = white, color=green, transp=0) // === /PLOTTING === // Send alert to TV alarm sub-system alertcondition(LONG,title="Sell",message="Sell") alertcondition(SHORT,title="BuY",message="Buy") alertcondition(SHORT,title="BuY",message="Buy") alertcondition(SHORT,title="BuY",message="Buy") ////////////////////////////////////////////////////////////////////////////////VWMA len2 = input(100, minval=1, title="Smooth") src = input(close, title="Source") out = vwma(src, len2) avg1=avg(out, xATRTrailingStop) plot(avg1, color=aqua, transp=0, title="ATR")
프로필 이미지

예스스탁 예스스탁 답변

2022-06-02 16:45:50

안녕하세요 예스스탁입니다. 예스랭귀지에서 검색식은 특정조건이 만족하는 봉에 점을 찍어 표시하는 식입니다. 올리신 내용 중에는 시스템식 정도가 검색식으로 변경해 드릴수 있습니다 시스템식을 매수조건만족하면 봉의 고가에, 매도조건이 만족하면 봉의 저가에 점이 표시되게 작성해 드립니다. input : nATRPeriod(21),nATRMultip(6.3); var : xATR(0),nLoss(0),xATRTrailingStop(0),pos(0),color(0); var : isLong(False),isshort(False),LONG(False),Short(False); xATR = atr(nATRPeriod); nLoss = nATRMultip * xATR; xATRTrailingStop = iff(close > xATRTrailingStop and close[1] > xATRTrailingStop, max(xATRTrailingStop[1], close - nLoss), iff(close < xATRTrailingStop and close[1] < xATRTrailingStop, min(xATRTrailingStop[1], close + nLoss), iff(close > xATRTrailingStop, close - nLoss, close + nLoss))); if CrossUp(C,xATRTrailingStop) Then pos = 1; if CrossDown(C,xATRTrailingStop) Then pos = -1; LONG = pos != pos[1] and pos == 1; SHORT = pos != pos[1] and pos == -1; if LONG Then { isLong = true; isShort = false; Plot1(H,"검색",Magenta); } if SHORT Then { isLong = false; isShort = true; Plot1(L,"검색",Cyan); } 즐거운 하루되세요 > 귀족온달 님이 쓴 글입니다. > 제목 : Re : Re : 트레이딩뷰 지표소스 검색식 > 감사합니다.고생해주셨는데.제가 무지해서 검색식을 만들가 없네요..ㅠ.ㅠ > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 트레이딩뷰 지표소스 검색식 > 안녕하세요 예스스탁입니다. 예스랭귀지는 수식의 종류별로 각각 작성해서 차트에 적용하셔야 합니다. 올리신 수식에는 강조식으로 작성될 내용, 시스템식으로 작성될 내용, 지표로 작성될 내용 총 3가지가 있습니다. 1 강조식 input : nATRPeriod(21),nATRMultip(6.3); var : xATR(0),nLoss(0),xATRTrailingStop(0),pos(0),color(0); var : isLong(False),isshort(False),LONG(False),Short(False); xATR = atr(nATRPeriod); nLoss = nATRMultip * xATR; xATRTrailingStop = iff(close > xATRTrailingStop and close[1] > xATRTrailingStop, max(xATRTrailingStop[1], close - nLoss), iff(close < xATRTrailingStop and close[1] < xATRTrailingStop, min(xATRTrailingStop[1], close + nLoss), iff(close > xATRTrailingStop, close - nLoss, close + nLoss))); if CrossUp(C,xATRTrailingStop) Then pos = 1; if CrossDown(C,xATRTrailingStop) Then pos = -1; LONG = pos != pos[1] and pos == 1; SHORT = pos != pos[1] and pos == -1; if LONG Then { isLong = true; isShort = false; } if SHORT Then { isLong = false; isShort = true; } PlotPaintBar(H,L,"강조", iff(isLong , lime , IFf( isShort , red , Nan))); 2 시스템식 input : nATRPeriod(21),nATRMultip(6.3); var : xATR(0),nLoss(0),xATRTrailingStop(0),pos(0),color(0); var : isLong(False),isshort(False),LONG(False),Short(False); xATR = atr(nATRPeriod); nLoss = nATRMultip * xATR; xATRTrailingStop = iff(close > xATRTrailingStop and close[1] > xATRTrailingStop, max(xATRTrailingStop[1], close - nLoss), iff(close < xATRTrailingStop and close[1] < xATRTrailingStop, min(xATRTrailingStop[1], close + nLoss), iff(close > xATRTrailingStop, close - nLoss, close + nLoss))); if CrossUp(C,xATRTrailingStop) Then pos = 1; if CrossDown(C,xATRTrailingStop) Then pos = -1; LONG = pos != pos[1] and pos == 1; SHORT = pos != pos[1] and pos == -1; if LONG Then { isLong = true; isShort = false; Buy("Buy"); } if SHORT Then { isLong = false; isShort = true; Sell("Sell"); } 3 지표식 inputs:len2(100); var: VolumeSum(0),VWMA(0); VolumeSum = AccumN( v, len2 ) ; VWMA = AccumN( C * v , len2 ) / len2 ; plot1(Vwma); 즐거운 하루되세요 > 귀족온달 님이 쓴 글입니다. > 제목 : 트레이딩뷰 지표소스 검색식 > 트레이딩뷰 지표소스로 종목 검색식을 만들고 싶은데 가능할까요? 지표상 Buy 신호 종목 검색을 하고 싶습니다. //@version=3 study(title="ATR Smoothed (By dysrupt)_BuySell version", shorttitle="ATR_SM_BuySell", overlay = true) //Modifyed by @guikroth ////////////////////////////////////////////////////////////////////////////////INPUTS nATRPeriod = input(21, "Period") nATRMultip = input(6.3, "Multiplier",type=float, minval=0.5, maxval=1000, step=0.1) /////////////////////////////////////////////////////////////////////////////////ATR xATR = atr(nATRPeriod) nLoss = nATRMultip * xATR xATRTrailingStop = na 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 = na 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 ? lime : blue //patr=plot(xATRTrailingStop, color=color, linewidth=2, title="ATR Trailing Stop", transp=0) // Deternine if we are currently LONG isLong = false isLong := nz(isLong[1], false) // Determine if we are currently SHORT isShort = false isShort := nz(isShort[1], false) //Trading // Buy only if the buy signal is triggered and we are not already long LONG = not isLong and pos == 1 // Sell only if the sell signal is triggered and we are not already short SHORT = not isShort and pos == -1 if (LONG) isLong := true isShort := false if (SHORT) isLong := false isShort := true barcolor(isLong ? lime : isShort ? red : na) // Show Break Alerts plotshape(SHORT, title="Sell", style=shape.labeldown, location=location.abovebar, size=size.normal, text="Sell", transp=0, textcolor = white, color=red, transp=0) plotshape(LONG, title="Buy", style=shape.labelup, location=location.belowbar, size=size.normal, text="Buy", textcolor = white, color=green, transp=0) // === /PLOTTING === // Send alert to TV alarm sub-system alertcondition(LONG,title="Sell",message="Sell") alertcondition(SHORT,title="BuY",message="Buy") alertcondition(SHORT,title="BuY",message="Buy") alertcondition(SHORT,title="BuY",message="Buy") ////////////////////////////////////////////////////////////////////////////////VWMA len2 = input(100, minval=1, title="Smooth") src = input(close, title="Source") out = vwma(src, len2) avg1=avg(out, xATRTrailingStop) plot(avg1, color=aqua, transp=0, title="ATR")
프로필 이미지

귀족온달

2022-06-02 17:15:22

지표 표시가 아닌 종목 검색으로는 안되나요? 바쁘신데 죄송합니다. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : Re : Re : 트레이딩뷰 지표소스 검색식 > 안녕하세요 예스스탁입니다. 예스랭귀지에서 검색식은 특정조건이 만족하는 봉에 점을 찍어 표시하는 식입니다. 올리신 내용 중에는 시스템식 정도가 검색식으로 변경해 드릴수 있습니다 시스템식을 매수조건만족하면 봉의 고가에, 매도조건이 만족하면 봉의 저가에 점이 표시되게 작성해 드립니다. input : nATRPeriod(21),nATRMultip(6.3); var : xATR(0),nLoss(0),xATRTrailingStop(0),pos(0),color(0); var : isLong(False),isshort(False),LONG(False),Short(False); xATR = atr(nATRPeriod); nLoss = nATRMultip * xATR; xATRTrailingStop = iff(close > xATRTrailingStop and close[1] > xATRTrailingStop, max(xATRTrailingStop[1], close - nLoss), iff(close < xATRTrailingStop and close[1] < xATRTrailingStop, min(xATRTrailingStop[1], close + nLoss), iff(close > xATRTrailingStop, close - nLoss, close + nLoss))); if CrossUp(C,xATRTrailingStop) Then pos = 1; if CrossDown(C,xATRTrailingStop) Then pos = -1; LONG = pos != pos[1] and pos == 1; SHORT = pos != pos[1] and pos == -1; if LONG Then { isLong = true; isShort = false; Plot1(H,"검색",Magenta); } if SHORT Then { isLong = false; isShort = true; Plot1(L,"검색",Cyan); } 즐거운 하루되세요 > 귀족온달 님이 쓴 글입니다. > 제목 : Re : Re : 트레이딩뷰 지표소스 검색식 > 감사합니다.고생해주셨는데.제가 무지해서 검색식을 만들가 없네요..ㅠ.ㅠ > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 트레이딩뷰 지표소스 검색식 > 안녕하세요 예스스탁입니다. 예스랭귀지는 수식의 종류별로 각각 작성해서 차트에 적용하셔야 합니다. 올리신 수식에는 강조식으로 작성될 내용, 시스템식으로 작성될 내용, 지표로 작성될 내용 총 3가지가 있습니다. 1 강조식 input : nATRPeriod(21),nATRMultip(6.3); var : xATR(0),nLoss(0),xATRTrailingStop(0),pos(0),color(0); var : isLong(False),isshort(False),LONG(False),Short(False); xATR = atr(nATRPeriod); nLoss = nATRMultip * xATR; xATRTrailingStop = iff(close > xATRTrailingStop and close[1] > xATRTrailingStop, max(xATRTrailingStop[1], close - nLoss), iff(close < xATRTrailingStop and close[1] < xATRTrailingStop, min(xATRTrailingStop[1], close + nLoss), iff(close > xATRTrailingStop, close - nLoss, close + nLoss))); if CrossUp(C,xATRTrailingStop) Then pos = 1; if CrossDown(C,xATRTrailingStop) Then pos = -1; LONG = pos != pos[1] and pos == 1; SHORT = pos != pos[1] and pos == -1; if LONG Then { isLong = true; isShort = false; } if SHORT Then { isLong = false; isShort = true; } PlotPaintBar(H,L,"강조", iff(isLong , lime , IFf( isShort , red , Nan))); 2 시스템식 input : nATRPeriod(21),nATRMultip(6.3); var : xATR(0),nLoss(0),xATRTrailingStop(0),pos(0),color(0); var : isLong(False),isshort(False),LONG(False),Short(False); xATR = atr(nATRPeriod); nLoss = nATRMultip * xATR; xATRTrailingStop = iff(close > xATRTrailingStop and close[1] > xATRTrailingStop, max(xATRTrailingStop[1], close - nLoss), iff(close < xATRTrailingStop and close[1] < xATRTrailingStop, min(xATRTrailingStop[1], close + nLoss), iff(close > xATRTrailingStop, close - nLoss, close + nLoss))); if CrossUp(C,xATRTrailingStop) Then pos = 1; if CrossDown(C,xATRTrailingStop) Then pos = -1; LONG = pos != pos[1] and pos == 1; SHORT = pos != pos[1] and pos == -1; if LONG Then { isLong = true; isShort = false; Buy("Buy"); } if SHORT Then { isLong = false; isShort = true; Sell("Sell"); } 3 지표식 inputs:len2(100); var: VolumeSum(0),VWMA(0); VolumeSum = AccumN( v, len2 ) ; VWMA = AccumN( C * v , len2 ) / len2 ; plot1(Vwma); 즐거운 하루되세요 > 귀족온달 님이 쓴 글입니다. > 제목 : 트레이딩뷰 지표소스 검색식 > 트레이딩뷰 지표소스로 종목 검색식을 만들고 싶은데 가능할까요? 지표상 Buy 신호 종목 검색을 하고 싶습니다. //@version=3 study(title="ATR Smoothed (By dysrupt)_BuySell version", shorttitle="ATR_SM_BuySell", overlay = true) //Modifyed by @guikroth ////////////////////////////////////////////////////////////////////////////////INPUTS nATRPeriod = input(21, "Period") nATRMultip = input(6.3, "Multiplier",type=float, minval=0.5, maxval=1000, step=0.1) /////////////////////////////////////////////////////////////////////////////////ATR xATR = atr(nATRPeriod) nLoss = nATRMultip * xATR xATRTrailingStop = na 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 = na 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 ? lime : blue //patr=plot(xATRTrailingStop, color=color, linewidth=2, title="ATR Trailing Stop", transp=0) // Deternine if we are currently LONG isLong = false isLong := nz(isLong[1], false) // Determine if we are currently SHORT isShort = false isShort := nz(isShort[1], false) //Trading // Buy only if the buy signal is triggered and we are not already long LONG = not isLong and pos == 1 // Sell only if the sell signal is triggered and we are not already short SHORT = not isShort and pos == -1 if (LONG) isLong := true isShort := false if (SHORT) isLong := false isShort := true barcolor(isLong ? lime : isShort ? red : na) // Show Break Alerts plotshape(SHORT, title="Sell", style=shape.labeldown, location=location.abovebar, size=size.normal, text="Sell", transp=0, textcolor = white, color=red, transp=0) plotshape(LONG, title="Buy", style=shape.labelup, location=location.belowbar, size=size.normal, text="Buy", textcolor = white, color=green, transp=0) // === /PLOTTING === // Send alert to TV alarm sub-system alertcondition(LONG,title="Sell",message="Sell") alertcondition(SHORT,title="BuY",message="Buy") alertcondition(SHORT,title="BuY",message="Buy") alertcondition(SHORT,title="BuY",message="Buy") ////////////////////////////////////////////////////////////////////////////////VWMA len2 = input(100, minval=1, title="Smooth") src = input(close, title="Source") out = vwma(src, len2) avg1=avg(out, xATRTrailingStop) plot(avg1, color=aqua, transp=0, title="ATR")