High-performance, easy-to-use open source quantitative trading framework
1
2
func Demo(pol *config.RunPolicyConfig) *strat.TradeStrat {
3
smlLen := int(pol.Def("smlLen", 5, core.PNorm(3, 10)))
4
bigLen := int(pol.Def("bigLen", 20, core.PNorm(10, 40)))
5
return &strat.TradeStrat{
6
WarmupNum: 100,
7
OnBar: func(s *strat.StratJob) {
8
e := s.Env
9
ma5 := ta.SMA(e.Close, smlLen)
10
ma20 := ta.SMA(e.Close, bigLen)
11
maCrx := ta.Cross(ma5, ma20)
12
},
13
}
14
Implement strategies and backtesting faster!