The Saturn5 trading strategy, implemented as a class, performs technical analysis on a given dataframe of financial data. It populates various indicators based on the input parameters provided. In the populate_indicators method, the strategy calculates and adds the following indicators to the dataframe:
Short-term exponential moving averages (s1_ema_xs, s1_ema_sm, s1_ema_md, s1_ema_xl, s1_ema_xxl)
s2_ema, calculated based on the input time period and offset values
s2_ema_xxl_off, calculated as a modified version of s2_ema_xxl using a Fibonacci lower value
s2_ema_xxl, a simple moving average calculated over a fixed time period
s2_bb_std_dev_value, standard deviation for s2_bb_lower_band calculations
s2_bb_lower_band, lower Bollinger Band calculated using a simple moving average and a standard deviation offset
s2_fib_lower_band, a Fibonacci lower band calculated using a simple moving average and an average true range offset
s3_bb_lowerband, the lower band of Bollinger Bands calculated using a typical price and a window size of 20
The populate_buy_trend method populates the "buy" column of the dataframe based on specific buy signals.
The buy signals are determined by various conditions:
buy_signal_1: The conditions include checking for a crossover of vwmacd below the signal, the low price being below s1_ema_xxl, the close price being below s1_ema_xxl, a crossover of s1_ema_sm above s1_ema_md, and positive volume.
buy_signal_2: The conditions include checking for a crossover of s2_fib_lower_band above s2_bb_lower_band, the close price being below s2_ema, and positive volume.
buy_signal_3: The conditions include checking for the low price being below s3_bb_lowerband, the low price being above s1_ema_xxl, and positive volume. If any of the buy signals are not enabled, the corresponding buy column values are set to 0. The populate_sell_trend method sets the "sell" column values of the dataframe to 0 for all rows. Overall, the Saturn5 strategy utilizes various indicators and buy signals to determine the appropriate times to buy assets based on the provided financial data.