The VWAPAlarm strategy is designed to backtest trading strategies based on the Volume Weighted Average Price (VWAP) indicator. Here's a breakdown of what the strategy does:
It calculates the VWAP indicator using a rolling window of 14 periods on a 2-hour timeframe. It checks if the current price is a certain percentage above the VWAP and if the previous candle closed above the VWAP.
Specifically, it checks if the low of the previous candle is above the VWAP and if the current price is within a certain range above the VWAP.
If the conditions are met and an alarm has not been emitted for the trading pair, it triggers an alarm by producing a sound (using the beep function) and opens the Binance trading page for that pair in a web browser.
It calculates the distance percentage between the current price and the VWAP. It keeps track of whether an alarm has been emitted for each trading pair to avoid duplicate alarms. It provides a minimal return on investment (ROI) of 10% and sets a stop loss at -99%. It operates on a 3-minute timeframe and only processes new candles. It has placeholder functions for populating the buy and sell signals in the backtesting results. Overall, the strategy aims to identify trading opportunities where the price is above the VWAP and has a specific relationship with the previous candle's price and VWAP. It is designed to generate buy signals based on these conditions and provides a basic ROI target and stop loss.