Skip to content

Latest commit

 

History

History
155 lines (107 loc) · 6.5 KB

README.md

File metadata and controls

155 lines (107 loc) · 6.5 KB

volatility

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

Package volatility contains the volatility 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

func AllStrategies() []strategy.Strategy

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

BollingerBandsStrategy represents the configuration parameters for calculating the Bollinger Bands strategy. A closing value crossing above the upper band suggets a Buy signal, while crossing below the lower band indivates a Sell signal.

type BollingerBandsStrategy struct {
    // BollingerBands represents the configuration parameters for calculating the Bollinger Bands.
    BollingerBands *volatility.BollingerBands[float64]
}

func NewBollingerBandsStrategy() *BollingerBandsStrategy

NewBollingerBandsStrategy function initializes a new Bollinger Bands strategy instance.

func (*BollingerBandsStrategy) Compute

func (b *BollingerBandsStrategy) Compute(snapshots <-chan *asset.Snapshot) <-chan strategy.Action

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

func (*BollingerBandsStrategy) Name

func (*BollingerBandsStrategy) Name() string

Name returns the name of the strategy.

func (*BollingerBandsStrategy) Report

func (b *BollingerBandsStrategy) Report(c <-chan *asset.Snapshot) *helper.Report

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

SuperTrendStrategy represents the configuration parameters for calculating the Super Trend strategy. A closing value crossing above the Super Trend suggets a Buy signal, while crossing below the Super Trend indivates a Sell signal.

type SuperTrendStrategy struct {
    // SuperTrend represents the configuration parameters for calculating the Super Trend.
    SuperTrend *volatility.SuperTrend[float64]
}

func NewSuperTrendStrategy() *SuperTrendStrategy

NewSuperTrendStrategy function initializes a new Super Trend strategy instance.

func NewSuperTrendStrategyWith(superTrend *volatility.SuperTrend[float64]) *SuperTrendStrategy

NewSuperTrendStrategyWith function initializes a new Super Trend strategy with the given Super Trend instance.

func (*SuperTrendStrategy) Compute

func (s *SuperTrendStrategy) Compute(snapshots <-chan *asset.Snapshot) <-chan strategy.Action

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

func (*SuperTrendStrategy) Name

func (s *SuperTrendStrategy) Name() string

Name returns the name of the strategy.

func (*SuperTrendStrategy) Report

func (s *SuperTrendStrategy) 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