MACD Pine简单策略

MACD
创建日期: 2022-04-12 13:46:18 最后修改: 2022-05-23 18:08:17
复制: 25 点击次数: 1776
avatar of 发明者量化 发明者量化
11
关注
523
关注者
策略源码
/*backtest
start: 2021-05-04 00:00:00
end: 2022-05-03 23:59:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Bitfinex","currency":"BTC_USD"}]
*/


fastPeriod = input(12, "fast")
slowPeriod = input.int(26, "slow")
singnalPeriod = input.float(9, "signal")


[fast, slow, _] = ta.macd(close, fastPeriod, slowPeriod, singnalPeriod)
plot(fast, 'fast')
plot(slow, 'slow')

if fast>slow and fast[1]<slow[1]
    strategy.entry("Enter Long", strategy.long)
else if fast<slow and fast[1]>slow[1]
    strategy.entry("Enter Short", strategy.short)
    
相关推荐
全部留言
avatar of 皓月当空
皓月当空
老师,为什么运行出现错误,GetAccount: 401: {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action, request ip: 43.198.104.193"}无效 我已经绑定了api
2023-08-26 19:44:56
avatar of 皓月当空
皓月当空
老师,为什么运行出现错误
2023-08-26 19:43:47