Skip to content

Latest commit

 

History

History
120 lines (82 loc) · 4.1 KB

README.md

File metadata and controls

120 lines (82 loc) · 4.1 KB

compound

import "github.com/cinar/indicator/v2/strategy/compound"

Package compound contains the compound strategy functions.

This package belongs to the Indicator project. Indicator is a Golang module that supplies a variety of technical indicators, strategies, and a backtesting framework for analysis.

License

Copyright (c) 2021-2024 Onur Cinar.
The source code is provided under GNU AGPLv3 License.
https://github.com/cinar/indicator

Disclaimer

The information provided on this project is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.

Index

Constants

const (
    // DefaultMacdRsiStrategyBuyAt defines the default RSI level at which a Buy action is generated.
    DefaultMacdRsiStrategyBuyAt = 30

    // DefaultMacdRsiStrategySellAt defines the default RSI level at which a Sell action is generated.
    DefaultMacdRsiStrategySellAt = 70
)

func AllStrategies() []strategy.Strategy

AllStrategies returns a slice containing references to all available compound strategies.

MacdRsiStrategy represents the configuration parameters for calculating the MACD-RSI strategy.

type MacdRsiStrategy struct {
    // MacdStrategy is the MACD strategy instance.
    MacdStrategy *trend.MacdStrategy

    // RsiStrategy is the RSI strategy instance.
    RsiStrategy *momentum.RsiStrategy
}

func NewMacdRsiStrategy() *MacdRsiStrategy

NewMacdRsiStrategy function initializes a new MACD-RSI strategy instance with the default parameters.

func NewMacdRsiStrategyWith(buyAt, sellAt float64) *MacdRsiStrategy

NewMacdRsiStrategyWith function initializes a new MACD-RSI strategy instance with the given parameters.

func (*MacdRsiStrategy) Compute

func (m *MacdRsiStrategy) Compute(snapshots <-chan *asset.Snapshot) <-chan strategy.Action

Compute processes the provided asset snapshots and generates a stream of actionable recommendations.

func (*MacdRsiStrategy) Name

func (m *MacdRsiStrategy) Name() string

Name returns the name of the strategy.

func (*MacdRsiStrategy) Report

func (m *MacdRsiStrategy) Report(c <-chan *asset.Snapshot) *helper.Report

Report processes the provided asset snapshots and generates a report annotated with the recommended actions.

Generated by gomarkdoc