Trend strategies generate signals based on a trend indicator.
The ChandeForecastOscillatorStrategy uses cfo values that are generated by the ChandeForecastOscillator indicator function to provide a BUY action when cfo is below zero, and SELL action when cfo is above zero.
actions := indicator.ChandeForecastOscillatorStrategy(asset)
The KdjStrategy function uses the k, d, j values that are generated by the Kdj indicator function to provide a BUY action when k crosses above d and j. It is stronger when below 20%. Also the SELL action is when k crosses below d and j. It is strong when above 80%.
actions := indicator.KdjStrategy(rPeriod, kPeriod, dPeriod, asset)
As the KdjStrategy function does not match the StrategyFunction, the MakeKdjStrategy function takes rPeriod, kPeriod, dPeriod, and provides a strategy function.
strategy := indicator.MakeKdjStrategy(rPeriod, kPeriod, dPeriod)
actions := strategy(asset)
By default, rPeriod of 9, kPeriod of 3, and dPeriod of 3 are used. The DefaultKdjStrategy function can be used with those periods.
actions := indicator.DefaultKdjStrategy(asset)
The MacdStrategy uses the macd, and signal values that are generated by the Macd indicator function to provide a BUY action when macd crosses above signal, and SELL action when macd crosses below signal.
actions := indicator.MacdStrategy(asset)
The TrendStrategy provides a simply strategy to buy the given asset following the asset's closing value increases in count subsequent rows. Produces the sell action following the asset's closing value decreases in count subsequent rows.
actions := indicator.TrendStrategy(asset, 4)
The function signature of TrendStrategy does not match the StrategyFunction type, as it requires an additional count parameter. The MakeTrendStrategy function can be used to return a StrategyFunction instance based on the given count value.
strategy := indicator.MakeTrendStrategy(4)
actions := strategy(asset)
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.
Copyright (c) 2021 Onur Cinar. All Rights Reserved.
The source code is provided under MIT License.