The Ewt3 strategy is a trading strategy that involves the use of indicators to make buy and sell decisions. Here is a short description of what the strategy does:
The strategy has three main functions:
populate_indicators: This function populates the indicators used by the strategy. It takes a DataFrame containing price data and additional metadata as input.
It checks if the pair in the metadata is already present in the custom trade information.
If not, it initializes it.
It then checks the timeframe and performs indicator calculations accordingly. If the timeframe is the same as the informative timeframe, it applies indicator calculations directly on the input dataframe. Otherwise, it requires a data provider and fetches the informative pair's data, performs indicator calculations on it, and merges it with the input dataframe. populate_buy_trend: This function populates the buy signals for the strategy. It takes the populated dataframe and metadata as input. It calculates the EWO (Elliott Wave Oscillator) indicator and the EMA (Exponential Moving Average) indicator using the specified lengths. It then sets the 'buy' column to 1 for the rows where the following conditions are met:
Volume is greater than 0. Either:
EWO is greater than the specified buy threshold and the opening price is greater than the EMA, or
EWO is less than the specified low buy threshold. populate_sell_trend: This function populates the sell signals for the strategy. It takes the populated dataframe and metadata as input. It calculates the EWO indicator using the specified lengths. It then sets the 'sell' column to 1 for the rows where the following conditions are met:
EWO is less than or equal to the specified sell threshold. Volume is greater than 0. The strategy also includes a function called sell_signal that determines whether to sell based on the sell reason and profit ratio. If the sell reason is 'sell_signal' and the profit ratio calculated by the trade object is less than 0.02, it returns False indicating not to sell; otherwise, it returns True indicating to sell. Overall, the Ewt3 strategy uses indicators such as EWO and EMA to generate buy and sell signals based on specified thresholds and conditions.