在 TradingView 中编写固定收益指标代码 — 分步说明

使用 Pine Script 计算极值检测指标

在 TradingView 中编写固定收益指标代码 — 分步说明

先决条件

固定收益指标

在 Pine 脚本中编写固定回报

  1. //@version=5
  1. indicator("固定收益", overlay=false)
  1. mid_prices = hl2
  2. rolling_mid_prices = ta.sma(hl2, 10)
  1. stationary_returns = math.log(mid_prices) - math.log(rolling_mid_prices)
  1. stationary_returns_daily = request.security(syminfo.tickerid, "D", stationary_returns)
  1. stationary_returns_avg = ta.sma(stationary_returns_daily, 20)
  1. top_band_value = input.float(0.05, title="Top Band")
  2. bot_band_value = input.float(-0.05, title="Bottom Band")hline(top_band_value, title="Top Band", color=color.red)
  3. hline(bot_band_value, title="Bottom Band", color=color.red)
  1. plot(stationary_returns_avg, title="固定收益平均值", color=color.green)
  2. plot(stationary_returns_daily, title="固定收益", color=color.blue)
  1. //@version=5
  2. indicator("Stationary Returns", overlay=false)top_band_value = input.float(0.05, title="Top Band")
  3. bot_band_value = input.float(-0.05, title="Bottom Band")mid_prices = hl2
  4. rolling_mid_prices = ta.sma(hl2, 15)stationary_returns = math.log(mid_prices) - math.log(rolling_mid_prices)stationary_returns_daily = request.security(syminfo.tickerid, "D", stationary_returns)stationary_returns_avg = ta.sma(stationary_returns_daily, 20)plot(stationary_returns_avg, title="Stationary Returns Average", color=color.green)
  5. plot(stationary_returns_daily, title="Stationary Returns")hline(top_band_value, title="Top Band", color=color.red)
  6. hline(bot_band_value, title="Bottom Band", color=color.red)
在 TradingView 中编写固定收益指标代码 — 分步说明

最后的想法

  • 对你所做的每一个分析都有批判的心态。
  • 确保您已经使用现实生活中的模拟和条件对其进行了回测。
  • 如果有好看的潜力,请通过前瞻性测试运行它。
量化交易

OCO和LEOCO交易——最安全、最高效的半自动交易策略

2022-9-5 20:52:44

区块链资讯量化交易

高频加密货币交易的完整介绍

2022-10-24 21:20:45

0 条回复 A文章作者 M管理员
欢迎您,新朋友,感谢参与互动!
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
私信列表
搜索