Skip to content

Latest commit

 

History

History
132 lines (90 loc) · 4.89 KB

File metadata and controls

132 lines (90 loc) · 4.89 KB

compound

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

Package compound provides illustrative examples demonstrating how to compose multiple indicator strategies into unified signals for educational and research purposes.

This package belongs to the Indicator project. These strategy implementations are provided purely as educational and research examples illustrating how developers can consume core indicator mathematics.

License

Copyright (c) 2021-2026 The Indicator Authors.
The source code is provided under GNU AGPLv3 License.
https://github.com/cinar/indicator

Disclaimer

The information and example strategies provided in this package are strictly for educational and research purposes only and must not be construed as investment, financial, tax, or trading advice.

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 wraps ComputeWithContext for backwards compatibility.

Deprecated: Use ComputeWithContext instead.

func (*MacdRsiStrategy) ComputeWithContext

func (m *MacdRsiStrategy) ComputeWithContext(ctx context.Context, snapshots <-chan *asset.Snapshot) <-chan strategy.Action

ComputeWithContext 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