微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 BTCUSD 的 RSI 上买入或卖出

如何解决在 BTCUSD 的 RSI 上买入或卖出

我正在研究涉及 Pine Script 的策略。我的策略涉及 20 周期的 RSI 指标。如果 RSI 穿过 70,我就买入,如果 RSI 穿过 30,我就卖出。但是,如果蜡烛穿过 70 或 30,我会在下一根蜡烛开盘时入场。开盘蜡烛必须低于 30 或 70,这就是我正在努力帮助的地方?

这是我的代码

//@version=4
{   strategy("Bitcoin Strategy RSI",overlay = false,pyramiding = 0,currency = currency.USD,initial_capital = 10000,commission_value = 0)

    period = input(20)
    r = rsi(close,period)

    plot(r,color = color.teal)
    hline(30,color = color.white,linestyle = hline.style_dashed,linewidth = 1)
    hline(70,linewidth = 1)

    if (r < 30 and r[0] < 30)
        strategy.entry( "Sell Entry",long  = false)

    if (r > 70 and r[0] > 70)
        strategy.entry( "Buy Entry",long  = true)


    strategy.exit("Buy Exit","Buy Entry",profit = 150000,loss = 125000 )
    strategy.exit("Selling Exit","Sell Entry",loss = 125000 )

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。