Price Dip Scalping

Line chart titled 'Scalping Trader' illustrating buying and selling points over time in minutes or days. Green 'BUY' indicators and red 'SELL' indicators mark entry and exit points on the fluctuating white line.

Definition

During strong bullish trends or bearish trends, the chart have always a set back before continuing the trend direction. By identifying these setback on a small time fram (1 - 5 minutes), user can identify good buying points for scalping trades.

Usage

To identify general trend of a security chart, we use a MA with large smoothing value (for example 50).

For identifying short dips in a bullish trend, we use a medium term MA and a short term MA. When the short Term MA crosses Medium Term MA downwards and then subsequently upwards, then a dip is persent. A dip is confirmed if the overall trend line is bullish.

To identify Dips in a bearish trend, the faster MA should cross above the medium MA and then subsequently below it. If the overall Trend is bearish, then a dip is confirmed.

To collect proifts, a TP should be reasonably set up (typical value 5%). To protect against unepected market movements, a SL of 10% can be applied.

PineScript

  • Short dip in an overall bullish trend

Stock trading chart showing candlestick patterns, with green and red candles, multiple moving averages, and buy/sell indicators for Rheinmetal AG on TradingView.
Snippet

//@version=5strategy("Buy on Small Dip in Bullish Trend", overlay=true) // --- Input Parameters for MA Lengths ---// Input for the length of the short Moving Average (e.g., for quick movements/dips)shortMaLength = input.int(10, "Short MA Length", minval=1) // Input for the length of the medium Moving Average (e.g., for intermediate movements/dips)mediumMaLength = input.int(50, "Medium MA Length", minval=1) // Input for the length of the long Moving Average (e.g., for main trend identification)longMaLength = input.int(200, "Long MA Length", minval=1) // --- Risk Management Parameters ---// Stop loss set to 10% as requestedstopLossPercent = input.float(10.0, "Stop Loss %", minval=0.1, step=0.1) / 100// Take profit set to 3% as requestedtakeProfitPercent = input.float(3.0, "Take Profit %", minval=0.1, step=0.1) / 100 // --- Moving Average Calculations ---// Calculate the short-period Simple Moving Average of the closing priceshortMa = ta.sma(close, shortMaLength) // Calculate the medium-period Simple Moving Average of the closing pricemediumMa = ta.sma(close, mediumMaLength) // Calculate the long-period Simple Moving Average of the closing pricelongMa = ta.sma(close, longMaLength) // --- Trend and Dip Conditions ---// Condition for a long-term bullish trend:// Current price is above the long-term MA, and the long-term MA itself is sloping upwards.isBullishTrend = close > longMa and longMa > longMa[1] // Condition for a small dip:// The short MA crosses below the medium MA (indicating a dip starts),// AND then the short MA crosses back above the medium MA (indicating the dip ends and uptrend resumes).// We use `ta.crossunder` to detect the dip initiation and `ta.crossover` for the dip recovery.dipInitiated = ta.crossunder(shortMa, mediumMa)dipRecovered = ta.crossover(shortMa, mediumMa) // A buy signal is generated when the dip recovers AND the overall trend is bullish.buySignal = dipRecovered and isBullishTrend // --- Entry Logic ---// Enter a long position when the buy signal is trueif buySignal strategy.entry("BuyDip", strategy.long) // --- Exit Logic (Stop Loss and Take Profit) ---// Calculate stop loss and take profit prices based on entry pricelongStopPrice = strategy.position_avg_price * (1 - stopLossPercent)longTakeProfitPrice = strategy.position_avg_price * (1 + takeProfitPercent) // Apply stop loss and take profit orders for the "BuyDip" entrystrategy.exit("Exit", from_entry="BuyDip", stop=longStopPrice, limit=longTakeProfitPrice)  // --- Plotting Moving Averages ---// Plot the short MA on the chart (e.g., green for faster movement)plot(shortMa, "Short MA", color=color.green, linewidth=2) // Plot the medium MA on the chart (e.g., orange for intermediate movement)plot(mediumMa, "Medium MA", color=color.orange, linewidth=2) // Plot the long MA on the chart (e.g., blue for main trend)plot(longMa, "Long MA", color=color.blue, linewidth=3) 
  • Short dip in an overall bearish trend

Stock chart depicting the S&P/BMV IPC CompMx Short-Term Momentum Index with candlestick patterns declining, along with moving average lines in blue, yellow, and green.
Snippet

//@version=5strategy("Sell on Small Upwards Flip in Bearish Trend", overlay=true) // --- Input Parameters for MA Lengths ---// Input for the length of the short Moving Average (e.g., for quick movements/flips)shortMaLength = input.int(10, "Short MA Length", minval=1) // Input for the length of the medium Moving Average (e.g., for intermediate movements/flips)mediumMaLength = input.int(50, "Medium MA Length", minval=1) // Input for the length of the long Moving Average (e.g., for main trend identification)longMaLength = input.int(200, "Long MA Length", minval=1) // --- Risk Management Parameters ---// Stop loss set to 10% for short positions (above entry price)stopLossPercent = input.float(10.0, "Stop Loss %", minval=0.1, step=0.1) / 100// Take profit set to 3% for short positions (below entry price)takeProfitPercent = input.float(3.0, "Take Profit %", minval=0.1, step=0.1) / 100 // --- Moving Average Calculations ---// Calculate the short-period Simple Moving Average of the closing priceshortMa = ta.sma(close, shortMaLength) // Calculate the medium-period Simple Moving Average of the closing pricemediumMa = ta.sma(close, mediumMaLength) // Calculate the long-period Simple Moving Average of the closing pricelongMa = ta.sma(close, longMaLength) // --- Trend and Flip Conditions ---// Condition for a long-term bearish trend:// Current price is below the long-term MA, and the long-term MA itself is sloping downwards.isBearishTrend = close < longMa and longMa < longMa[1] // Condition for a small upwards flip:// The short MA crosses above the medium MA (indicating a flip starts),// AND then the short MA crosses back below the medium MA (indicating the flip ends and downtrend resumes).flipInitiated = ta.crossover(shortMa, mediumMa)flipRecovered = ta.crossunder(shortMa, mediumMa) // A sell signal is generated when the flip recovers AND the overall trend is bearish.sellSignal = flipRecovered and isBearishTrend // --- Entry Logic ---// Enter a short position when the sell signal is trueif sellSignal strategy.entry("SellFlip", strategy.short) // --- Exit Logic (Stop Loss and Take Profit) ---// Calculate stop loss and take profit prices based on entry price for a short position// Stop loss is above entry price for a shortlongStopPrice = strategy.position_avg_price * (1 + stopLossPercent)// Take profit is below entry price for a shortlongTakeProfitPrice = strategy.position_avg_price * (1 - takeProfitPercent) // Apply stop loss and take profit orders for the "SellFlip" entrystrategy.exit("Exit", from_entry="SellFlip", stop=longStopPrice, limit=longTakeProfitPrice)  // --- Plotting Moving Averages ---// Plot the short MA on the chart (e.g., green for faster movement)plot(shortMa, "Short MA", color=color.green, linewidth=2) // Plot the medium MA on the chart (e.g., orange for intermediate movement)plot(mediumMa, "Medium MA", color=color.orange, linewidth=2) // Plot the long MA on the chart (e.g., blue for main trend)plot(longMa, "Long MA", color=color.blue, linewidth=3)

ThinkScript

  • Short dip in an overall bullish trend

Snippet

# Strategy "Buy on Small Dip in Bullish Trend"## This ThinkScript indicator visualizes the strategy by plotting the moving# averages and marking potential entry and exit points with bubbles.# It does not execute trades, but shows where they would occur.# declare upper; # --- Input Parameters ---# Input for the length of the short Moving Averageinput shortMaLength = 10;# Input for the length of the medium Moving Averageinput mediumMaLength = 50;# Input for the length of the long Moving Averageinput longMaLength = 200; # Risk Management Parametersinput stopLossPercent = 10.0; # Stop loss in percentinput takeProfitPercent = 3.0; # Take profit in percent # --- Moving Average Calculations ---def shortMa = SimpleMovingAvg(close, shortMaLength);def mediumMa = SimpleMovingAvg(close, mediumMaLength);def longMa = SimpleMovingAvg(close, longMaLength); # --- Trend and Dip Conditions ---# Condition for a long-term bullish trend:# Current price is above the long-term MA, and the long-term MA itself is sloping upwards.def isBullishTrend = close > longMa and longMa > longMa[1]; # Condition for a small dip:# The short MA crosses below the medium MA (dip initiated) and then# the short MA crosses back above the medium MA (dip recovered).def dipInitiated = shortMa[1] > mediumMa[1] and shortMa <= mediumMa;def dipRecovered = shortMa[1] <= mediumMa[1] and shortMa > mediumMa; # A buy signal is generated when the dip recovers AND the overall trend is bullish.def buySignal = dipRecovered and isBullishTrend; # --- Entry and Exit Logic Visualization ---# We'll use persistent variables to track the state of a potential trade.# 'isPositionOpen' will track if a trade has been entered and not yet exited.def isPositionOpen = if buySignal then yes else if isPositionOpen[1] and (low < longStopPrice[1] or high > longTakeProfitPrice[1]) then no else isPositionOpen[1]; # 'entryPrice' will store the closing price of the bar where the buy signal was generated.def entryPrice = if buySignal then close else entryPrice[1]; # --- Exit Price Calculations ---# Calculate stop loss and take profit prices based on the entry price.def longStopPrice = entryPrice * (1 - stopLossPercent / 100);def longTakeProfitPrice = entryPrice * (1 + takeProfitPercent / 100); # --- Plotting ---# Plot the three moving averages with distinct colors and line styles.plot ShortMA = shortMa;ShortMA.SetDefaultColor(Color.GREEN);ShortMA.SetLineWeight(2); plot MediumMA = mediumMa;MediumMA.SetDefaultColor(Color.ORANGE);MediumMA.SetLineWeight(2); plot LongMA = longMa;LongMA.SetDefaultColor(Color.BLUE);LongMA.SetLineWeight(3); # Plot the Stop Loss and Take Profit lines only when a position is "open".plot StopLoss = if isPositionOpen then longStopPrice else Double.NaN;StopLoss.SetDefaultColor(Color.RED);StopLoss.SetStyle(Curve.SHORT_DASH);StopLoss.HideBubble();StopLoss.SetLineWeight(1); plot TakeProfit = if isPositionOpen then longTakeProfitPrice else Double.NaN;TakeProfit.SetDefaultColor(Color.GREEN);TakeProfit.SetStyle(Curve.SHORT_DASH);TakeProfit.HideBubble();TakeProfit.SetLineWeight(1); # Add chart bubbles to mark entry and exit points.AddChartBubble(buySignal, high, "Buy Dip", Color.GREEN, yes);AddChartBubble(isPositionOpen[1] and (low < longStopPrice[1] or high > longTakeProfitPrice[1]), low, "Exit", Color.GRAY, no); 
  • Short dip in an overall bearish trend

Snippet

#Strategy "Sell on Small Upwards Flip in Bearish Trend"## This ThinkScript indicator visualizes the strategy by plotting the moving# averages and marking potential entry and exit points with bubbles.# It does not execute trades, but shows where they would occur.# declare upper; # --- Input Parameters ---# Input for the length of the short Moving Averageinput shortMaLength = 10;# Input for the length of the medium Moving Averageinput mediumMaLength = 50;# Input for the length of the long Moving Averageinput longMaLength = 200; # Risk Management Parameters for a short positioninput stopLossPercent = 10.0; # Stop loss in percent (above entry)input takeProfitPercent = 3.0; # Take profit in percent (below entry) # --- Moving Average Calculations ---def shortMa = SimpleMovingAvg(close, shortMaLength);def mediumMa = SimpleMovingAvg(close, mediumMaLength);def longMa = SimpleMovingAvg(close, longMaLength); # --- Trend and Flip Conditions ---# Condition for a long-term bearish trend:# Current price is below the long-term MA, and the long-term MA itself is sloping downwards.def isBearishTrend = close < longMa and longMa < longMa[1]; # Condition for a small upwards flip:# The short MA crosses above the medium MA (flip initiated) and then# the short MA crosses back below the medium MA (flip recovered).def flipInitiated = shortMa[1] <= mediumMa[1] and shortMa > mediumMa;def flipRecovered = shortMa[1] > mediumMa[1] and shortMa <= mediumMa; # A sell signal is generated when the flip recovers AND the overall trend is bearish.def sellSignal = flipRecovered and isBearishTrend; # --- Entry and Exit Logic Visualization ---# We'll use persistent variables to track the state of a potential trade.# 'isPositionOpen' will track if a trade has been entered and not yet exited.def isPositionOpen = if sellSignal then yes else if isPositionOpen[1] and (high > shortStopPrice[1] or low < shortTakeProfitPrice[1]) then no else isPositionOpen[1]; # 'entryPrice' will store the closing price of the bar where the sell signal was generated.def entryPrice = if sellSignal then close else entryPrice[1]; # --- Exit Price Calculations for a Short Position ---# Calculate stop loss and take profit prices based on the entry price.# For a short, stop loss is above entry, take profit is below entry.def shortStopPrice = entryPrice * (1 + stopLossPercent / 100);def shortTakeProfitPrice = entryPrice * (1 - takeProfitPercent / 100); # --- Plotting ---# Plot the three moving averages with distinct colors and line styles.plot ShortMA = shortMa;ShortMA.SetDefaultColor(Color.GREEN);ShortMA.SetLineWeight(2); plot MediumMA = mediumMa;MediumMA.SetDefaultColor(Color.ORANGE);MediumMA.SetLineWeight(2); plot LongMA = longMa;LongMA.SetDefaultColor(Color.BLUE);LongMA.SetLineWeight(3); # Plot the Stop Loss and Take Profit lines only when a position is "open".plot StopLoss = if isPositionOpen then shortStopPrice else Double.NaN;StopLoss.SetDefaultColor(Color.RED);StopLoss.SetStyle(Curve.SHORT_DASH);StopLoss.HideBubble();StopLoss.SetLineWeight(1); plot TakeProfit = if isPositionOpen then shortTakeProfitPrice else Double.NaN;TakeProfit.SetDefaultColor(Color.GREEN);TakeProfit.SetStyle(Curve.SHORT_DASH);TakeProfit.HideBubble();TakeProfit.SetLineWeight(1); # Add chart bubbles to mark entry and exit points.AddChartBubble(sellSignal, low, "Sell Flip", Color.RED, yes);AddChartBubble(isPositionOpen[1] and (high > shortStopPrice[1] or low < shortTakeProfitPrice[1]), high, "Exit", Color.GRAY, no);