The "BuyOnly" strategy is a trading strategy implemented as a class that inherits from the "IStrategy" class. It is designed to backtest and evaluate trading signals based on various technical indicators. The strategy has three main components: indicator population, buy signal population, and sell signal population.
In the "populate_indicators" method, several technical indicators are calculated and added to the input DataFrame.
These indicators include:
Relative Strength Index (RSI)
Moving Average Convergence Divergence (MACD)
Bollinger Bands
Stop and Reverse (SAR)
Triple Exponential Moving Average (TEMA)
The "populate_buy_trend" method determines the buy signals based on certain conditions.
The buy signals are populated in the DataFrame by setting the "buy" column to 1 for the rows that meet the specified criteria. The buy conditions include:
RSI crossing above 30
Opening price being below the lower Bollinger Band
TEMA (Triple Exponential Moving Average) increasing compared to the previous period
Volume being greater than 0
The "populate_sell_trend" method does not implement any specific sell signals and simply returns the DataFrame as is, implying a "HODL" (Hold) strategy. Overall, the "BuyOnly" strategy calculates various technical indicators and generates buy signals based on specific conditions, while not providing explicit sell signals.