Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add all volume strategies to backtest. #235

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/indicator-backtest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/cinar/indicator/v2/strategy/momentum"
"github.com/cinar/indicator/v2/strategy/trend"
"github.com/cinar/indicator/v2/strategy/volatility"
"github.com/cinar/indicator/v2/strategy/volume"
cinar marked this conversation as resolved.
Show resolved Hide resolved
)

func main() {
Expand Down Expand Up @@ -70,6 +71,7 @@ func main() {
backtester.Strategies = append(backtester.Strategies, strategy.AllStrategies()...)
backtester.Strategies = append(backtester.Strategies, trend.AllStrategies()...)
backtester.Strategies = append(backtester.Strategies, volatility.AllStrategies()...)
backtester.Strategies = append(backtester.Strategies, volume.AllStrategies()...)

if addSplits {
backtester.Strategies = append(backtester.Strategies, strategy.AllSplitStrategies(backtester.Strategies)...)
Expand Down
2 changes: 1 addition & 1 deletion strategy/volume/money_flow_index_strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewMoneyFlowIndexStrategyWith(sellAt, buyAt float64) *MoneyFlowIndexStrateg

// Name returns the name of the strategy.
func (m *MoneyFlowIndexStrategy) Name() string {
return fmt.Sprintf("Money Flow Index Strategy (%f)", m.SellAt)
return fmt.Sprintf("Money Flow Index Strategy (%f,%f)", m.SellAt, m.BuyAt)
}

// Compute processes the provided asset snapshots and generates a stream of actionable recommendations.
Expand Down
4 changes: 3 additions & 1 deletion strategy/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ import (

// AllStrategies returns a slice containing references to all available volume strategies.
func AllStrategies() []strategy.Strategy {
return []strategy.Strategy{}
return []strategy.Strategy{
NewMoneyFlowIndexStrategy(),
}
}
Loading