简体   繁体   English

高于或低于 0 时的买入卖出条件和警报

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

Please see below the indicator.请看下面的指标。 It is an oscillator that shows the time segmented volume.它是一个显示时间分段成交量的振荡器。 I would like to add alerts or alertcondition on it.我想在上面添加警报或警报条件。 Buy signal when the bar is above 0, and sell signal when the bar is below 0. I couldn't figure out how to do it.当柱线高于 0 时买入信号,当柱线低于 0 时卖出信号。我不知道该怎么做。

Thanks for your help谢谢你的帮助

//      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)

Ok.好的。 I figured it out.我想到了。

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.

相关问题 将策略限价买入(或卖出)转换为警报 - Converting strategy Limit Buy (or Sell) to alerts 如何在第一根蜡烛线下方的低点上方买入,在第一根蜡烛线上方的高点下方卖出 - How to buy on the first candle with a low above the lower boll band, sell on first candle with a high below upper boll band 当我的买入条件满足直到我的卖出条件满足时,如何 plot 一条水平线? - How to plot a horizontal line when my buy condition met till my sell conditions met? 仅在蜡烛收盘时进行买卖 - Plot buy or sell only when candle closes 我想修改这个,比如当蜡烛突破或收盘时买入&gt;阻力,当蜡烛突破或收盘时卖出&lt;支撑 - i want to modify this like buy when candles breaks above or close > resistance and sell when candles break down or close < support 当 MFI 高于 50 并且 DMI+ 穿过 DMI- 时,如何创建一个将买入/卖出信号放在图表上的 pine 脚本 - How create a pine script that places buy/sell signals on chart when the MFI is above 50 AND the DMI+ crosses the DMI- Pine Script - 满足多种条件的 TradingView 买入/卖出指标 - Pine Script - Buy/Sell indicator for TradingView that meets multiple conditions 如何使我的脚本同时适用于 Macd 和 ema 的买入和卖出指标作为 pine 脚本中的条件 - How do I make my script work for both buy and sell indicators for Macd and ema as conditions in pine scripting 买/卖订单的执行订单 - Execution order of buy / sell orders 在指标消息上自动买入/卖出 - Buy/ sell automaticly on Indicators message
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM