簡體   English   中英

高於或低於 0 時的買入賣出條件和警報

[英]Buy sell conditions and alerts when it is above or below 0

請看下面的指標。 它是一個顯示時間分段成交量的振盪器。 我想在上面添加警報或警報條件。 當柱線高於 0 時買入信號,當柱線低於 0 時賣出信號。我不知道該怎么做。

謝謝你的幫助

//      Written by liw0 active on https://www.tradingview.com/u/liw0
//      corrected version by vitelot December 2018 -- no charity required

//      If you decide to use my script in your published charts,
//      please keep this header as it is now and leave the name unchanged!
//      It would make me happy to see my script put to use in other charts :)

//      If you like it I would also be happy about a small donation
//      BTC 1GyfGTBsVHMbPovFGFeipe7b7ET1aebGx5

//      Questions or Comments? Just send me a PM!

//      CREDITS: http://quant.stackexchange.com/questions/2816/how-to-calculate-time-segmented-volume

//@version=5
indicator('Time Segmented Volume', shorttitle='TSV', overlay=false)

l = input(defval=13, title='TSV Length')


//t = sum(close>close[1]?volume*close-close[1]:close<close[1]?(volume*-1)*close-close:0,l)
// previous line is non sensical. The correct version follows
t = math.sum(close > close[1] ? volume * (close - close[1]) : close < close[1] ? volume * (close - close[1]) : 0, l)

SwapColor = t > 0 ? color.green : color.red

plot(series=t, title='TSV Histogram', color=SwapColor, style=plot.style_histogram, histbase=0, linewidth=1)

好的。 我想到了。

if t > 0
    alert(message='Buy TSE', freq=alert.freq_once_per_bar)
    
if t < 0
    alert(message='Sell TSE', freq=alert.freq_once_per_bar)    

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM