The ReinforcedAverageStrategy is a proof-of-concept trading strategy that buys and sells based on crossovers. Here is a breakdown of how the strategy works:
Indicators:
Moving Averages: The strategy calculates two moving averages, namely "maShort" with a time period of 8 and "maMedium" with a time period of 21. Bollinger Bands: The strategy also calculates Bollinger Bands with a window of 20 and 2 standard deviations.
Three bands are generated: "bb_lowerband," "bb_upperband," and "bb_middleband."
Simple Moving Average: Another indicator, the simple moving average (SMA), is calculated with a time period of 50 on a resampled version of the dataframe.
Buy Signal:
The strategy generates a buy signal when the following conditions are met:
The "maShort" crosses above the "maMedium."
The closing price is higher than the resampled SMA.
The volume is greater than 0. Sell Signal:
The strategy generates a sell signal when the following condition is met:
The "maMedium" crosses above the "maShort."
The volume is greater than 0. ROI and Stoploss:
The minimal return on investment (ROI) for the strategy is set to 0.5, meaning that the strategy aims for a 0.5% gain on each trade. The stoploss is set at -0.2, indicating that if the trade's value drops by 0.2%, it will be sold. Timeframe and Trailing Stoploss:
The strategy operates on a 4-hour timeframe. Trailing stoploss is disabled in this strategy. Note: This strategy is not optimized for performance and is primarily intended as a proof of concept.