Moving Average Scalping

Definition

The strategy uses Moving Averages to identify bullish and bearish fast price movements. The strategy is similar to normal crossing averages strategy, but should be applied on a small time frame as Scalping makes use of fast-paced price fluctuations.

Usage

Deployed will be 2 crossing moving averages (SMA or EMA). One MA will have a smaller smoothing value (Typically 5 Period MA) on a 1 to 5 minutes time frame. The other one will have a larger smoothing value (Typically 20 Period MA).

Confirmation signals for a bullish price movement are that price is above the shorter MA. A confirmation signal is that the faster MA will cross over the slower MA.

Bearish price movement is identified by price going below the faster MA and confirmed my the faster MA crossing below the slower MA.

PineScript

  • Long Position MA Scalping Strategy

Snippet

// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © Angel_faze21 //@version=6// This Pine Script document creates a scalping strategy based on moving average crossovers.// It uses a 5-period Simple Moving Average (SMA) as the faster MA and a 15-period SMA as the slower MA. // Declare the script as a strategystrategy(title="MA Scalping Strategy", shorttitle="MA Scalper", overlay=true) // Define the lengths for the moving averagesfastMALength = input.int(5, title="Fast MA Length", minval=1)slowMALength = input.int(15, title="Slow MA Length", minval=1) // Calculate the Simple Moving AveragesfastMA = ta.sma(close, fastMALength)slowMA = ta.sma(close, slowMALength) // Plot the moving averages on the chart for visual confirmationplot(fastMA, color=color.blue, title="Fast MA")plot(slowMA, color=color.red, title="Slow MA") // Define the buy condition: fast MA crosses above slow MAbuyCondition = ta.crossover(fastMA, slowMA) // Define the sell condition: fast MA crosses below slow MAsellCondition = ta.crossunder(fastMA, slowMA) // Execute a long entry when the buy condition is metif buyCondition strategy.entry("Long", strategy.long) // Close the long position when the sell condition is metif sellCondition strategy.close("Long") // Optional: Add a stop loss and take profit (commented out by default, uncomment to use)// strategy.exit("Take Profit/Stop Loss", from_entry="Long", profit=100, loss=50) // Example: 100 ticks profit, 50 ticks loss // Optional: Add a message to the chart when an entry or exit occurs// bgcolor(buyCondition ? color.new(color.green, 90) : na, title="Buy Signal Background")// bgcolor(sellCondition ? color.new(color.red, 90) : na, title="Sell Signal Background")
  • Short Position Crossing MA Scalping Strategy

Snippet

// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © Angel_faze21 //@version=6// This Pine Script document creates a scalping strategy based on moving average crossovers.// It uses a 5-period Simple Moving Average (SMA) as the faster MA and a 15-period SMA as the slower MA.// This version is modified to only take short positions. // Declare the script as a strategystrategy(title="MA Scalping Strategy (Short Only)", shorttitle="MA Scalper Short", overlay=true) // Define the lengths for the moving averagesfastMALength = input.int(5, title="Fast MA Length", minval=1)slowMALength = input.int(15, title="Slow MA Length", minval=1) // Calculate the Simple Moving AveragesfastMA = ta.sma(close, fastMALength)slowMA = ta.sma(close, slowMALength) // Plot the moving averages on the chart for visual confirmationplot(fastMA, color=color.blue, title="Fast MA")plot(slowMA, color=color.red, title="Slow MA") // Define the short entry condition: fast MA crosses below slow MAshortEntryCondition = ta.crossunder(fastMA, slowMA) // Define the cover (exit short) condition: fast MA crosses above slow MAcoverCondition = ta.crossover(fastMA, slowMA) // Execute a short entry when the short entry condition is metif shortEntryCondition strategy.entry("Short", strategy.short) // Close the short position (cover) when the cover condition is metif coverCondition strategy.close("Short") // Optional: Add a stop loss and take profit (commented out by default, uncomment to use)// strategy.exit("Take Profit/Stop Loss", from_entry="Short", profit=100, loss=50) // Example: 100 ticks profit, 50 ticks loss for short // Optional: Add a message to the chart when an entry or exit occurs// bgcolor(shortEntryCondition ? color.new(color.red, 90) : na, title="Short Signal Background")// bgcolor(coverCondition ? color.new(color.green, 90) : na, title="Cover Signal Background")