mirror of
https://github.com/lukewilson2002/autotrader.git
synced 2025-08-02 13:19:32 +00:00
Fixed MORE bugs
This commit is contained in:
@@ -21,9 +21,9 @@ func (s *SMAStrategy) Next(t *auto.Trader) {
|
||||
sma2 := t.Data().Closes().Copy().Rolling(s.period2).Mean()
|
||||
// If the shorter SMA crosses above the longer SMA, buy.
|
||||
if auto.CrossoverIndex(*t.Data().Date(-1), sma1, sma2) {
|
||||
t.Buy(1000)
|
||||
t.Buy(1000, 0, 0)
|
||||
} else if auto.CrossoverIndex(*t.Data().Date(-1), sma2, sma1) {
|
||||
t.Sell(1000)
|
||||
t.Sell(1000, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user