跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[投资] 有个非常简单的量化策略,但是试了好几个框架和平台都无法实现,大家帮忙看看

发表于

策略(简化版)如下:

  1. 以每天的开市价格买入,然后在当天的收市价格平仓卖出。
  2. 要求策略运行在日线级别的数据上

试了 TradingView/Pinescript ,以及几个 Python 框架包括(backtesting.py 和 backtrader),都会遇到同样的问题: 它们没法在同一个 bar 上做两笔交易:开仓和平仓,如果在一天开仓买入了,那么平仓的操作就只能等到第二天才能触发。

在 TradingView 上我只能用分钟级别来模拟:在 1 分钟级别上的第一个 bar 开仓买入,最后一个 bar 平仓卖出。这样做的问题是 TradingView 对 bar 的数量有限制,导致只能回测不到一个月的数据。如果加大时间的粒度(比如到 5 分钟级别),这样可以回测大概四个月的数据,但是时间粒度越粗会导致价格误差越大。

大家帮忙看一下这个策略本身有问题吗(不考虑盈利性等问题,单纯讨论技术实现)?我觉得这个不存在 look-ahead 等问题吧,因为在实盘中我也可以在开盘的时候买入,然后等到收盘的时候卖出,或者直接设置 Market Close Order 自动在收盘时平仓。

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.