Skip to content

Latest commit

 

History

History
58 lines (36 loc) · 2.55 KB

compound_strategies.md

File metadata and controls

58 lines (36 loc) · 2.55 KB

Compound Strategies

Compound strategies combine multiple strategies together to generate signals.

All Strategies

The AllStrategies function takes one or more StrategyFunction and provides a StrategyFunction that will return a BUY or SELL action if all strategies are returning the same action, otherwise it will return a HOLD action.

strategy := indicator.AllStrategies(indicator.MacdStrategy, indicator.DefaultRsiStrategy)
actions := strategy(asset)

Run Strategies

The RunStrategies function takes one or more StrategyFunction and returns the actions for each.

actions := indicator.RunStrategies(asset, indicator.MacdStrategy, indicator.DefaultRsiStrategy)

Separate Strategies

The SeparateStrategies function takes a buy strategy and a sell strategy.

It returns a BUY action if the buy strategy returns a BUY action and the the sell strategy returns a HOLD action.

It returns a SELL action if the sell strategy returns a SELL action and the buy strategy returns a HOLD action.

It returns HOLD otherwise.

strategy := indicator.SeparateStrategies(indicator.MacdStrategy, indicator.DefaultRsiStrategy)
actions := strategy(asset)

MACD and RSI Strategy

The MacdAndRsiStrategy function is a compound strategy that combines the MacdStrategy and the DefaultRsiStrategy. It will return a BUY or SELL action if both strategies are turning the same action, otherwise, it will return a HOLD action.

actions := indicator.MacdAndRsiStrategy(asset)

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.

License

Copyright (c) 2021 Onur Cinar. All Rights Reserved.

The source code is provided under MIT License.