IC Markets

High-Velocity Bitcoin Scalping: M1/M5 Price Action Strategy & Custom MT4 Execution Script

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
PTScalper
Site Admin
Posts: 1114
Joined: Mon Jul 20, 2026 1:28 pm

High-Velocity Bitcoin Scalping: M1/M5 Price Action Strategy & Custom MT4 Execution Script

Post by PTScalper »

Hi traders :-)

After years of refining high-volume scalping strategies on traditional forex and silver markets, I’ve been applying similar real-time price action principles to Bitcoin. BTC’s intraday volatility can be incredibly rewarding, but as we all know, execution speed is everything when you're hunting for small, rapid moves.

Today, I want to break down a fast-paced BTC scalping approach and share a custom MT4 script I wrote to automate the execution mechanics.

The Core Strategy: Price Action on M1/M5

When trading BTC on lower timeframes, traditional indicators often lag too much. This strategy relies purely on price action, liquidity sweeps, and order flow momentum.

Timeframe: M1 for entry precision, M5 for structural bias.

The Setup (The Liquidity Sweep): We are looking for periods of tight consolidation followed by a sharp, high-volume wick that sweeps local support or resistance (a classic stop hunt).

The Trigger: Enter immediately on the close of the rejection candle back inside the consolidation range.

Risk/Reward: Strict 1:1.5 or 1:2. In crypto, you don't want to hold these micro-positions for long. Take the profit and wait for the next setup.

The Execution: MT4 1-Click Risk Management Script
If you are executing manually on MT4, trying to calculate your exact lot size for BTC while the price is violently whipping around will cost you the entry.

I wrote this lightweight MT4 script to instantly execute a trade with a pre-calculated lot size based on a fixed risk percentage.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 1114
Joined: Mon Jul 20, 2026 1:28 pm

Re: High-Velocity Bitcoin Scalping: M1/M5 Price Action Strategy & Custom MT4 Execution Script

Post by PTScalper »

How to use it:

Assign the script to a hotkey in MT4.

When your setup aligns, hit the hotkey. The script calculates your position size based on your account balance and predefined risk, then fires the order with an attached stop-loss and take-profit.

Code: Select all

//+------------------------------------------------------------------+
//|                                          BTC_Scalp_Execution.mq4 |
//|                                      1-Click Risk Manager Script |
//+------------------------------------------------------------------+
#property strict
#property show_inputs

input double RiskPercentage = 1.0;     // Risk per trade (%)
input int StopLossPoints = 5000;       // Stop Loss in points (adjust for your broker's BTC digits)
input int TakeProfitPoints = 10000;    // Take Profit in points

void OnStart()
  {
   double accountEquity = AccountEquity();
   double tickValue = MarketInfo(Symbol(), MODE_TICKVALUE);
   double point = MarketInfo(Symbol(), MODE_POINT);
   
   // Calculate Lot Size based on Risk %
   double riskAmount = accountEquity * (RiskPercentage / 100.0);
   double lotSize = NormalizeDouble(riskAmount / (StopLossPoints * tickValue), 2);
   
   // Enforce Broker Lot Limits
   double minLot = MarketInfo(Symbol(), MODE_MINLOT);
   double maxLot = MarketInfo(Symbol(), MODE_MAXLOT);
   if(lotSize < minLot) lotSize = minLot;
   if(lotSize > maxLot) lotSize = maxLot;
   
   double ask = MarketInfo(Symbol(), MODE_ASK);
   double sl = ask - (StopLossPoints * point);
   double tp = ask + (TakeProfitPoints * point);
   
   // Execute Market Buy Order
   int ticket = OrderSend(Symbol(), OP_BUY, lotSize, ask, 3, sl, tp, "BTC Scalp", 0, 0, clrBlue);
   
   if(ticket < 0)
     {
      Print("OrderSend failed with error #", GetLastError());
     }
   else
     {
      Print("BTC Scalp Executed: Lot Size = ", lotSize);
     }
  }
//+------------------------------------------------------------------+
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 1114
Joined: Mon Jul 20, 2026 1:28 pm

Re: High-Velocity Bitcoin Scalping: M1/M5 Price Action Strategy & Custom MT4 Execution Script

Post by PTScalper »

Here are the adapted execution scripts for MT5 and cTrader.

Because the underlying architecture differs significantly across platforms—MT5 requires strict order structure handling, and cTrader processes volume in units rather than lots—the mathematical calculations for risk and volume have been native-optimized for each environment.

1. MetaTrader 5 (MQL5)

MT5 handles order routing differently than MT4, so this uses the standard #include <Trade\Trade.mqh> library to cleanly manage the execution. It also ensures the lot size strictly conforms to the broker's minimum volume steps, which is critical for crypto CFDs.

Code: Select all

//+------------------------------------------------------------------+
//|                                          BTC_Scalp_Execution.mq5 |
//|                                      1-Click Risk Manager Script |
//+------------------------------------------------------------------+
#property strict
#property script_show_inputs

#include <Trade\Trade.mqh>

input double RiskPercentage = 1.0;     // Risk per trade (%)
input int StopLossPoints = 5000;       // Stop Loss in points
input int TakeProfitPoints = 10000;    // Take Profit in points

void OnStart()
  {
   CTrade trade;
   double accountEquity = AccountInfoDouble(ACCOUNT_EQUITY);
   double point = SymbolInfoDouble(_Symbol, SYMBOL_POINT);
   double tickSize = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE);
   double tickValue = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE);
   
   if(tickSize == 0 || tickValue == 0) return; // Prevent division by zero
   
   // Normalize point value for crypto pricing
   double pointValue = tickValue * (point / tickSize);
   
   // Calculate Lot Size based on Risk %
   double riskAmount = accountEquity * (RiskPercentage / 100.0);
   double lotSize = riskAmount / (StopLossPoints * pointValue);
   
   // Enforce Broker Volume Steps and Limits
   double minLot = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN);
   double maxLot = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX);
   double stepLot = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP);
   
   lotSize = MathFloor(lotSize / stepLot) * stepLot; // Round down to nearest step
   
   if(lotSize < minLot) lotSize = minLot;
   if(lotSize > maxLot) lotSize = maxLot;
   
   double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
   double sl = ask - (StopLossPoints * point);
   double tp = ask + (TakeProfitPoints * point);
   
   // Execute Market Buy Order
   if(!trade.Buy(lotSize, _Symbol, ask, sl, tp, "BTC Scalp MT5"))
     {
      Print("MT5 OrderSend failed. Error: ", trade.ResultRetcode());
     }
   else
     {
      Print("BTC Scalp Executed: Volume = ", lotSize);
     }
  }
//+------------------------------------------------------------------+
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 1114
Joined: Mon Jul 20, 2026 1:28 pm

Re: High-Velocity Bitcoin Scalping: M1/M5 Price Action Strategy & Custom MT4 Execution Script

Post by PTScalper »

cTrader (C#)

cTrader does not have a dedicated "Script" file type like MetaTrader. To mimic 1-click script behavior, this is written as a cBot that executes the order in its OnStart() method and immediately calls Stop() to terminate itself.

cTrader also calculates orders strictly in units and pips (not lots and points), so the math handles the point-to-pip conversion internally.

Code: Select all

using System;
using cAlgo.API;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class BTCScalpExecution : Robot
    {
        [Parameter("Risk Percentage", DefaultValue = 1.0)]
        public double RiskPercentage { get; set; }

        [Parameter("Stop Loss (Points)", DefaultValue = 5000)]
        public int StopLossPoints { get; set; }

        [Parameter("Take Profit (Points)", DefaultValue = 10000)]
        public int TakeProfitPoints { get; set; }

        protected override void OnStart()
        {
            double riskAmount = Account.Equity * (RiskPercentage / 100.0);
            
            // Convert Points to Pips (cTrader API requires SL/TP in Pips)
            double slInPips = StopLossPoints * (Symbol.TickSize / Symbol.PipSize);
            double tpInPips = TakeProfitPoints * (Symbol.TickSize / Symbol.PipSize);

            if (slInPips <= 0) 
            {
                Print("Invalid Stop Loss configuration.");
                Stop();
                return;
            }

            // Calculate Volume based on Risk
            double pipValuePerUnit = Symbol.PipValue / Symbol.VolumeInUnitsMin;
            double rawVolume = riskAmount / (slInPips * pipValuePerUnit);
            
            // Normalize volume to nearest broker step
            double volume = Symbol.NormalizeVolumeInUnits(rawVolume, RoundingMode.Down);

            if (volume < Symbol.VolumeInUnitsMin) volume = Symbol.VolumeInUnitsMin;
            if (volume > Symbol.VolumeInUnitsMax) volume = Symbol.VolumeInUnitsMax;

            // Execute Market Buy Order
            var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, volume, "BTC Scalp", slInPips, tpInPips);
            
            if (!result.IsSuccessful)
            {
                Print("Order failed: ", result.Error);
            }
            else
            {
                Print("BTC Scalp Executed: Units = ", volume);
            }

            // Terminate immediately to act as a one-click script
            Stop();
        }
    }
}
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 1114
Joined: Mon Jul 20, 2026 1:28 pm

Re: High-Velocity Bitcoin Scalping: M1/M5 Price Action Strategy & Custom MT4 Execution Script

Post by PTScalper »

Because TradingView is a cloud-based charting platform rather than a localized execution terminal, Pine Script cannot be used as a simple "drag-and-drop" manual 1-click execution script like in MetaTrader or cTrader.

Instead, Pine Script handles execution through Strategies (for backtesting and automated routing) or Indicators (using webhook alerts).

Here is the strategy framework written in Pine Script v5. It handles the same dynamic position sizing based on your equity and risk percentage, and places the orders with the specified point-based Stop Loss and Take Profit. You can swap out the placeholder entry condition with your specific liquidity sweep logic.

Code: Select all

//@version=5
strategy("BTC Scalp Execution Risk Manager", overlay=true, calc_on_every_tick=true, initial_capital=10000, commission_type=strategy.commission.percent, commission_value=0.05)

// --- Inputs ---
riskPercentage = input.float(1.0, title="Risk per Trade (%)", step=0.1)
slPoints       = input.int(5000, title="Stop Loss (Ticks/Points)")
tpPoints       = input.int(10000, title="Take Profit (Ticks/Points)")

// --- Position Sizing Logic ---
// Calculate risk amount based on current strategy equity
riskAmount = strategy.equity * (riskPercentage / 100.0)

// Calculate the actual price distance for the Stop Loss
slDistance = slPoints * syminfo.mintick
tpDistance = tpPoints * syminfo.mintick

// Calculate position size (Volume/Lots)
// Formula: Risk Amount / (Price Distance * Point Value)
posSize = riskAmount / (slDistance * syminfo.pointvalue)

// --- Entry Condition (Placeholder) ---
// Since TradingView doesn't support manual "1-click" hotkeys for scripts, 
// you will need to define your technical entry trigger here.
// Example: A simple momentum burst or sweep (replace this with your actual setup).
triggerCondition = ta.crossover(ta.sma(close, 3), ta.sma(close, 8))

// --- Execution ---
if (triggerCondition and strategy.position_size == 0)
    // Execute Market Buy
    strategy.entry("BTC_Scalp_Buy", strategy.long, qty=posSize)
    
    // Set fixed Stop Loss and Take Profit levels
    slLevel = close - slDistance
    tpLevel = close + tpDistance
    
    // Submit bracket exit orders
    strategy.exit("BTC_Scalp_Exit", "BTC_Scalp_Buy", stop=slLevel, limit=tpLevel)

// --- Visuals ---
plotchar(triggerCondition, title="Entry Trigger", char='⬆', location=location.belowbar, color=color.blue, size=size.small)
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 1114
Joined: Mon Jul 20, 2026 1:28 pm

Re: High-Velocity Bitcoin Scalping: M1/M5 Price Action Strategy & Custom MT4 Execution Script

Post by PTScalper »

How to use this for Live Execution
Since you are trading high-volume setups, running this purely as a visual backtest might not be enough. To bridge Pine Script to actual broker execution, you will need to utilize Webhooks:

Modify for Alerts: You can replace the strategy.* functions with an alert() function call.

JSON Payload: Format the alert() message to send a JSON payload containing the dynamically calculated posSize, slLevel, and tpLevel.

Bridge Software: Point the TradingView webhook URL to a bridge application (like PineConnector for MT4/MT5, or directly to an exchange API) which will parse the JSON and execute the trade on your live account with practically zero latency.

Let me know if you want the webhook JSON payload generation added to the code.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Post Reply