The CustomStoplossWithPSAR strategy is an example implementation of a trading strategy that uses the Parabolic SAR (PSAR) indicator for trailing stop-loss. Here is a short description of what the strategy does:
Timeframe: 1 hour
Stoploss: -0.2 (equivalent to a 20% stop-loss)
Custom Info: A dictionary to store custom information specific to each trading pair. The strategy consists of the following methods:
custom_stoploss(): This method calculates the trailing stop-loss based on the PSAR indicator.
It retrieves the PSAR value from the custom_info dictionary for the current trading pair and calculates a new stop-loss relative to the current rate.
The result is returned as a relative negative offset.
populate_indicators(): This method populates the indicators used by the strategy. It calculates the PSAR values using the ta.SAR() function and stores them in the dataframe['sar'] column. If in backtesting or hyperopt mode, it saves the PSAR values in the custom_info dictionary. populate_buy_trend(): This method determines the buy signal based on the strategy's conditions. In this case, it sets the 'buy' column to 1 when the PSAR value is smaller than the PSAR value of the previous candle. populate_sell_trend(): This method populates the sell signal for the given dataframe. In this example, it deactivates the sell signal by setting the 'sell' column to 0. Note: The populate_buy_trend() and populate_sell_trend() methods are placeholders and don't reflect the actual trading logic. They are included as examples and need to be adapted to your specific strategy. Overall, this strategy uses the PSAR indicator to determine the trailing stop-loss level for each trading pair and generates buy signals based on the PSAR values.