Pine 中的简单时间策略

时间:2021-07-15 09:10:09

标签: pine-script

我正在尝试编写一个简单的交易视图策略来支持市场在特定时间平均以特定方式移动的理论。

例如

我想在世界标准时间上午 9 点做空 100 并在世界标准时间每天上午 10 点平仓

我不是编码员,但尝试了一下..... 失败了。

可能有人有想法吗?

//@version=4

strategy("test")
if time > 32400
 strategy.entry("sell", strategy.short, 100
if time > 36000
 strategy.cancel_all()
plot(strategy.equity)

1 个答案:

答案 0 :(得分:0)

将此应用于 EURUSD,1

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © adolgov

//@version=4
strategy("My Strategy", overlay=true, default_qty_value=100, margin_long=100, margin_short=100)
if hour == 9 and minute == 0
    strategy.entry("My Short Entry Id", strategy.short)
if hour == 10
    strategy.close_all()