The AverageStrategy is a simple trading strategy implemented in Python using the Freqtrade library. It aims to generate buy and sell signals based on moving average crossovers. Here is a breakdown of the important parts of the strategy:
Minimal ROI: The strategy targets a minimal return on investment (ROI) of 0.5.
Stoploss: The strategy sets a stop loss at -0.2, which means that if the trade goes against the expected direction and the loss exceeds 20%, the position will be automatically sold.
Timeframe: The strategy operates on 4-hour candlestick data.
Buy Range Short/Long: These are parameters that define the short and long periods for calculating exponential moving averages (EMA). The short range is set between 5 and 20 with a default of 8, while the long range is set between 20 and 120 with a default of 21. Populate Indicators: This function calculates the EMA for all the specified ranges and adds them to the dataframe. Populate Buy Trend: This function generates a buy signal when the short EMA crosses above the long EMA and the volume is greater than 0. Populate Sell Trend: This function generates a sell signal when the long EMA crosses above the short EMA and the volume is greater than 0. Overall, the strategy is a basic proof of concept and may not perform well in real trading scenarios. It demonstrates the implementation of moving average crossovers as a signal for buying and selling assets.