Bitcoin Momentum Sales Strategy

Bitcoin Momentum Sales Strategy

KissCuseMe
2025-03-03
3

1. Momentum trading basic concept

  • definition: Strategy to measure the intensity of the trend and sell when it is rising and sells when it is a downward trend
  • Core principle: "The trend is a friend" -assumed that the existing flow will continue.

2.. Three key elements of strategy

  1. Momentum indicator: RSI, MACD, Stochastic
  2. Trend confirmation: Moving average (MA), Bolinger Band
  3. Trading volume analysis: OBV (On-Balance Volume), MFI (Money Flow Index)

3. Core logic implementation (Python)

3-1. Essential library installation

pip install ccxt pandas numpy TA-Lib python-dotenv

3-2. Real -time data collection (based on binance)

import ccxt
import pandas as pd

binance = ccxt.binance({
    'apiKey': 'YOUR_API_KEY',
    'secret': 'YOUR_SECRET',
    'enableRateLimit': True
})

# Query 1-hour bar data
ohlcv = binance.fetch_ohlcv('BTC/USDT', '1h')
df = pd.DataFrame(ohlcv, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms')

3-3. Technical indicator calculation

import talib

# RSI (14 period)
df['RSI'] = talib.RSI(df['close'], timeperiod=14)

# MACD (12,26,9)
df['MACD'], df['MACD_signal'], _ = talib.MACD(df['close'], 
                                            fastperiod=12, 
                                            slowperiod=26, 
                                            signalperiod=9)

# 50-day & 200-day moving average
df['MA50'] = talib.SMA(df['close'], timeperiod=50)
df['MA200'] = talib.SMA(df['close'], timeperiod=200)

# Bollinger Bands (20 days)
df['upper_band'], df['middle_band'], df['lower_band'] = talib.BBANDS(df['close'], 
                                                                    timeperiod=20)

3-4. Sales signal creation logic

def generate_signal(row):
    # Upward momentum conditions
    bull_condition = (
        (row['RSI'] > 50) &
        (row['MACD'] > row['MACD_signal']) &
        (row['close'] > row['MA200']) &
        (row['close'] > row['upper_band'])
    
    # Downward momentum conditions
    bear_condition = (
        (row['RSI'] < 45) &
        (row['MACD'] < row['MACD_signal']) &
        (row['close'] < row['MA200']) &
        (row['close'] < row['lower_band'])
    
    if bull_condition:
        return 'BUY'
    elif bear_condition:
        return 'SELL'
    else:
        return 'HOLD'

df['signal'] = df.apply(generate_signal, axis=1)

4. Risk management system

4-1. Position sizing

def calculate_position_size(balance, risk_percent=2, stop_loss_pct=5):
    max_risk = balance * (risk_percent/100)
    return max_risk / (stop_loss_pct/100)

4-2. Dynamic

def dynamic_stoploss(current_price, atr, multiplier=2):
    return current_price - (atr * multiplier)

4-3. Trailing stop

def update_trailing_stop(high_price, trail_percent=3):
    return high_price * (1 - (trail_percent/100))

5. Back testing example

initial_balance = 10000  # USDT
position = 0
balance = initial_balance
trailing_stop = None

for idx, row in df.iterrows():
    current_price = row['close']
    
    if row['signal'] == 'BUY' and position == 0:
        position = balance / current_price
        balance = 0
        trailing_stop = current_price * 0.97  # 3% initial stop loss
    elif row['signal'] == 'SELL' or current_price < trailing_stop:
        if position > 0:
            balance = position * current_price
            position = 0
            trailing_stop = None
    elif position > 0:
        # Trailing stop update
        trailing_stop = max(trailing_stop, current_price * 0.97)

final_balance = balance + (position * df.iloc[-1]['close'])
print(f"Final rate of return: {((final_balance/initial_balance)-1)*100:.2f}%")

6. Core consideration

  1. Volatility Management: Sleepy is required when the gap is rising/falling
  2. Transaction cost: Reflecting fees (recommended less than 0.1%) and Sleepy sebum
  3. Time zone selection:
    • Short -term: 15 minutes to 4 hours
    • Long -term: Ilbong ~ Jubong
  4. Black Swall Prevention: Main News Event Calendar OK required

7. Optimization Point

  • Parameter tuning: Movement average period, RSI threshold adjustment
  • Multi -time analysis: Combination with the top of the high time zone
  • Machine learning interlocking: predicted momentum acceleration with LSTM

8. Notes

❗ Prohibition of Division: Verification with data for more than 3 years

❗Classification confirmation: Evasion of the transaction volume less than 100 BTC

❗ Automation Limit: Number of API calls (usually 120 times per minute)

Before actual application

Bitcoin
momentum
trading

0

Table of Contents

  • 1. Momentum trading basic concept
  • 2.. Three key elements of strategy
  • 3. Core logic implementation (Python)
  • 3-1. Essential library installation
  • 3-2. Real -time data collection (based on binance)
  • 3-3. Technical indicator calculation
  • 3-4. Sales signal creation logic
  • 4. Risk management system
  • 4-1. Position sizing
  • 4-2. Dynamic
  • 4-3. Trailing stop
  • 5. Back testing example
  • 6. Core consideration
  • 7. Optimization Point
  • 8. Notes
This post is part of the Coupang Partners Program and may contain affiliate links, for which I may receive a commission.

Terms of ServicePrivacy PolicySupport
© 2025
I wish I had known in advance
All rights reserved.