
The main idea behind this strategy is to decide when to buy and sell cryptocurrency based on price momentum indicators. It tries to capture trends as price reversals happen and profit from the momentum of price movements.
The strategy uses two metrics to determine entry and exit signals. The first one is price itself – it checks the highest and lowest prices over the past 10 candlesticks. The second one is a momentum indicator based on price - the %K value.
Specifically, when the price falls below 98% of the highest price over the past 10 candlesticks (buy threshold), the strategy triggers a buy signal. This means a downward breakout has happened. Similarly when the price rises above 102% of the lowest price over the past 10 candlesticks (sell threshold), the strategy triggers a sell signal, meaning an upward breakout has occurred.
This way the strategy can capture reversal points as new trends form in price movement. By tuning the buy/sell thresholds, sensitivity of the strategy to breakout signals can be adjusted.
The biggest advantage of this strategy is that it considers both price level and momentum factors. Relying on momentum indicators allows more reliable capturing of true trend reversals instead of being misled by false breakouts. Specific advantages are:
Some risks to note with this strategy:
Mitigations:
Further optimizations for the strategy:
Overall this momentum breakout strategy is well suited for capturing short term trading opportunities in cryptocurrencies. It effectively capitalizes on momentum characteristics of price reversals for profit while controlling risk. Continued refinements to parameters and model can make the strategy more robust for consistent returns.
/*backtest
start: 2023-02-22 00:00:00
end: 2024-02-28 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © nyxover
//@version=5
strategy("Stratégie d'achat bas/vendre haut", shorttitle="Achat/Vente")
// Paramètres d'entrée
crypto = input("BTC", "Crypto-monnaie")
capital = input(1.0, "Capital de départ")
buy_threshold = input(0.02, "Seuil d'achat")
sell_threshold = input(0.02, "Seuil de vente")
fee_rate = input(0.01, "Taux de frais")
// Balances
var float initial_balance = na
var float current_balance = na
// Fonction pour calculer les frais
calculate_fees(amount) =>
amount * fee_rate
// Fonction pour acheter
should_buy() =>
close < ta.highest(close, 10) * (1 - buy_threshold)
// Fonction pour vendre
should_sell() =>
close > ta.lowest(close, 10) * (1 + sell_threshold)
// Logique de la stratégie
if barstate.isfirst
initial_balance := capital
current_balance := capital
if should_buy()
amount_to_buy = current_balance / close
fees = calculate_fees(amount_to_buy)
current_balance := current_balance - amount_to_buy - fees
strategy.entry("Achat", strategy.long)
if should_sell()
amount_to_sell = current_balance
fees = calculate_fees(amount_to_sell)
current_balance := current_balance - amount_to_sell - fees
strategy.close("Achat")
// Affichage des informations
plot(initial_balance, color=color.green, title="Capital de départ")
plot(current_balance, color=color.blue, title="Capital actuel")