This repository has been archived by the owner on Oct 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs: update to reflect change to algo tree structure
- Loading branch information
1 parent
b15fb7e
commit 668a578
Showing
3 changed files
with
48 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package strategy | ||
|
||
import ( | ||
gbt "github.com/dirkolbrich/gobacktest" | ||
"github.com/dirkolbrich/gobacktest/algo" | ||
) | ||
|
||
// BuyAndHold is a basic strategy, which creates a buy signal on every year change | ||
func BuyAndHold() *gbt.Strategy { | ||
// create a new strategy with an algo stack and load into the backtest | ||
strategy := gbt.NewStrategy("buy-and-hold-yearly") | ||
|
||
strategy.SetAlgo( | ||
algo.RunYearly(), // run on beginning of each year | ||
algo.CreateSignal("buy"), // always create a buy signal on a data event | ||
) | ||
|
||
return strategy | ||
} |