首页 > 解决方案 > 仅当在交易视图上满足条件时触发指标警报

问题描述

我需要帮助来使用两个指标创建 TradingView 警报条件:随机指标和市场解放者。该策略包括仅在随机数位于通道之外时触发来自 Market Liberator 的分歧(内置分歧警报)。

有可能吗? 这是一张图片

标签: pine-scripttradingview-api

解决方案


如果 'Market Liberator' 指标的源代码被关闭 - 恐怕这是不可能的。

但是,您的屏幕截图中的“市场解放者”看起来像是从免费的公共开源脚本中抄袭而来,它们有不同的名称,其中最流行的名称之一 - vumanchu cipher B

如果 Market Liberator 是开源 Cipher 指标的副本 - 您只需在背离警报中包含一个基于随机指标的额外条件,如下面的示例所示(使用 Vumanchu 的市场密码 B 脚本):

...
// Stoch indicator and inputs:
periodK = input(14, title="%K Length", minval=1)
smoothK = input(1, title="%K Smoothing", minval=1)
periodD = input(3, title="%D Smoothing", minval=1)
k = sma(stoch(close, high, low, periodK), smoothK)
d = sma(k, periodD)
// Stoch outside the 20-80 channel:
bool stochBuy = d < 20
bool stochSell = d > 80

// Divergence alerts from the MC script with additional stoch condition:
// bullish
alertcondition(buySignalDiv and stochBuy, 'Buy (Big green circle + Div)', 'Buy & WT Bullish Divergence & WT Overbought')
// bearish
alertcondition(sellSignalDiv and stochSell, 'Sell (Big red circle + Div)', 'Buy & WT Bearish Divergence & WT Overbought')

推荐阅读