Moving Average Crossover, Price vs MA, MACD Trend
Three classic trend strategies based on moving averages. All actions are market orders on a chart signal. The opposite signal closes the position (without reversing), and a new position opens on the next signal.
- Moving Average Crossover (
movingaveragecrossover) - the fast MA crossed the slow one upwards - buy, downwards - sell - Price vs MA (
pricevsma) - the close price crossed the MA upwards - buy, downwards - sell. You can enter not only at the moment of the crossover but on any candle while the price is on the right side of the MA - MACD Trend (
macdtrend) - the MACD line crossed the signal line upwards - buy, downwards - sell. A trend filter can be enabled
⚠️ Like any MA trend strategy, they lose in a sideways market because of frequent false crossovers.
Parameters
Moving Average Crossover
fast_ma_type,fast_ma_source,fast_ma_len- fast MA (default EMA, close, 9)slow_ma_type,slow_ma_source,slow_ma_len- slow MA (default EMA, close, 21)
Price vs MA
ma_type,ma_source,ma_len- MA (default SMA, close, 200)use_cross_entry- enter only at the moment of the crossover (default). If off - enter on any candle when the price is above the MA (long) or below it (short)
MACD Trend
ma_source,fast_len,slow_len,signal_len- price source and EMA lengths for MACD (default close, 12, 26, 9)use_trend_filter- long only in an uptrend, short only in a downtrend. Works together with the enabled trend filter blockfilter(see "Trend filter")
Common to all three
count_max- maximum number of entries into the position, including the first (default 1 - no adding). Adding happens on a repeated signal in the same direction (in Price vs MA - only withuse_cross_entryoff)entry_gap- minimum step for adding: the next entry only if the price is below the previous entry price *entry_gap(for long; mirrored for short). For example 0.98 - no closer than 2%. 0 - no limit
Backtest the strategy on historical data in the tester and run it in hamster-bot.