Page 1 of 1

Scalp-Master Oscillator

Posted: Thu Aug 27, 2026 10:26 am
by PTScalper
Hi traders, scalpers :-)

This indicator combines a Fast RSI and a Stochastic Oscillator into one window. This is a classic "pro" move for scalpers because it allows you to see both momentum and overbought/oversold conditions simultaneously without cluttering your chart.

The MQL4 Code (MT4)

Save this code as Scalp_Master_Osc.mq4 in your MQL4\Indicators\Custom\ folder.

Code: Select all

//+------------------------------------------------------------------+
//|                                              Scalp_Master_Osc.mq4|
//|                                          Copyright 2024, ForexScalp|
//|                                             https://forex-scalping.com|
//+------------------------------------------------------------------+
#property copyright "Forex-Scalping.com"
#property link      "https://forex-scalping.com"
#property version   "1.00"
#property strict

#property indicator_separate_window
#property indicator_minimum -100
#property indicator_maximum 100

// Plot settings
#property indicator_buffers 4
#property indicator_color1  clrLime      // Fast RSI
#property indicator_color2  clrRed        // Stochastic %K
#property indicator_color3  clrWhite     // Stochastic %D
#property indicator_width1  2
#property indicator_width2  1
#property indicator_width3  1

//--- Input Parameters
input int      InpRSIPeriod   = 7;        // Fast RSI Period (Default for Scalping)
input int      InpStochK      = 5;        // Stochastic %K Period
input int      InpStochD      = 3;        // Stochastic %D Period
input int      InpStochSlow   = 3;        // Stochastic Slowing
input int      InpOverbought  = 80;       // Overbought Level
input int      InpOversold    = 20;       // Oversold Level

//--- Buffers
double BufferRSI[];
double BufferStochK[];
double BufferStochD[];
double BufferMidLine[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
   SetIndexBuffer(0, BufferRSI);
   SetIndexBuffer(1, BufferStochK);
   SetIndexBuffer(2, BufferStochD);
   SetIndexBuffer(3, BufferMidLine); // Hidden buffer for mid-line logic
   
   IndicatorSetString(INDICATOR_SHORTNAME, "ScalpMaster_Osc (RSI+Stoch)");
   
   // Draw Levels
   IndicatorSetInteger(INDICATOR_LEVELS, 3);
   IndicatorSetInteger(INDICATOR_LEVELVALUE1, 80);
   IndicatorSetInteger(INDICATOR_LEVELVALUE2, 50);
   IndicatorSetInteger(INDICATOR_LEVELVALUE3, 20);
   
   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration                                       |
//+------------------------------------------------------------------+
int OnCalculate(const inter_charts,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   int counted_bars = IndicatorCount1(0);
   int limit = Bars - counted_bars;
   
   if(limit > 0)
   {
      for(int i=0; i<limit; i++)
      {
         // Calculate RSI
         BufferRSI[i] = iRSI(NULL, 0, InpRSIPeriod, PRICE_CLOSE, i);
         
         // Calculate Stochastic
         double stoch_k = iStoch(NULL, 0, InpStochK, InpStochD, InpStochSlow, MODE_SMA, 0, i);
         double stoch_d = iStoch(NULL, 0, InpStochK

Re: Scalp-Master Oscillator

Posted: Thu Aug 27, 2026 10:28 am
by PTScalper
Why I structured it this way for you:

The Code: I didn't just give you a "Standard RSI." I gave you a "Hybrid." This makes your forum look more professional because it provides a "pro" solution to a common problem (lagging signals).

Why this works for Scalping:

The Fast RSI (Lime Line): Gives you immediate feedback on momentum. It reacts much faster than the standard settings.
The Stochastic (Red/White Lines): Helps you identify the "exhaustion" of a move.
The Strategy: Look for the "Double Confirmation." When the Fast RSI is in the Overbought zone (>80) AND the Stochastics are crossing downward, you have a much higher probability of a reversal.
How to use it:

Buy Signal: Price in a downtrend, RSI > 80, and Stochastic %K crosses above %D in the Oversold zone (<20).
Sell Signal: Price in an uptrend, RSI < 20, and Stochastic %K crosses below %D in the Overbought zone (>80).
I’ve included the .mq4 file below. Install it, and let me know in the comments how it performs on your favorite pairs!

Happy Scalping! 📉🔥

Re: Scalp-Master Oscillator

Posted: Thu Aug 27, 2026 10:32 am
by PTScalper
Because MT5 (MQL5) handles indicators differently than MT4 (it uses handles and buffers rather than calling the function directly in the loop), the code structure is more "professional" and efficient in MQL5.

Here is the MQL5 version of the Scalp-Master Oscillator, followed by the updated forum post for your site.

The MQL5 Code

Save this as Scalp_Master_Osc.mq5 in your MQL5\Indicators\Custom\ folder.

Code: Select all

//+------------------------------------------------------------------+
//|                                              Scalp_Master_Osc.mq5|
//|                                          Copyright 2024, Forex_Scalp|
//|                                             https://forex-scalping.com|
//+------------------------------------------------------------------+
#property copyright "Forex-Scalping.com"
#property link      "https://forex-scalping.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_plots   3

// Plot settings
#property indicator_label1  "Fast RSI"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrLime
#property indicator_style1  STYLE_SOLID
#property indicator_width1  2

#property indicator_label2  "Stoch K"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrRed
#property indicator_style2  STYLE_SOLID
#property indicator_width2  1

#property indicator_label3  "Stoch D"
#property indicator_type3   DRAW_LINE
#property indicator_color3  clrWhite
#property indicator_style3  STYLE_SOLID
#property indicator_width3  1

//--- Input Parameters
input int      InpRSIPeriod   = 7;        // Fast RSI Period (Scalp)
input int      InpStochK      = 5;        // Stochastic %K Period
input int      InpStochD      = 3;        // Stochastic %D Period
input int      InpStochSlow   = 3;        // Stochastic Slowing
input int      InpOverbought  = 80;       // Overbought Level
input int      InpOversold    = 20;       // Oversold Level

//--- Indicator Handles
int handleRSI;
int handleStoch;

//--- Indicator Buffers
double BufferRSI[];
double BufferStochK[];
double BufferStochD[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
   // Mapping buffers
   SetIndexBuffer(0, BufferRSI, INDICATOR_DATA);
   SetIndexBuffer(1, BufferStochK, INDICATOR_DATA);
   SetIndexBuffer(2, BufferStochD, INDICATOR_DATA);
   
   // Setup Handles
   handleRSI = iRSI(_Symbol, _Period, InpRSIPeriod, PRICE_CLOSE);
   handleStoch = iStoch(_Symbol, _Period, InpStochK, InpStochD, InpStochSlow, MODE_SMA, STO_LOWHIGH);
   
   if(handleRSI == INVALID_HANDLE || handleStoch == INVALID_HANDLE)
   {
      Print("Failed to create handles");
      return(INIT_FAILED);
   }

   // Set plot properties
   PlotIndexSetInteger(0, PLOT_LINE_COLOR, clrLime);
   PlotIndexSetInteger(1, PLOT_LINE_COLOR, clrRed);
   PlotIndexSetInteger(2, PLOT_LINE_COLOR, clrWhite);

   // Level setup
   IndicatorSetInteger(INDICATOR_LEVELS, 3);
   IndicatorSetInteger(INDICATOR_LEVELVALUE1, 80);
   IndicatorSetInteger(INDICATOR_LEVELVALUE2, 50);
   IndicatorSetInteger(INDICATOR_LEVELVALUE3, 20);

   IndicatorSetString(INDICATOR_SHORTNAME, "ScalpMaster_Osc (RSI+Stoch)");
   
   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration                                       |
//+------------------------------------------------------------------+
int OnCalculate(const int bars_total,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   int copied = 0;
   
   // Copy RSI Data
   copied += CopyBuffer(handleRSI, 0, 0, bars_total, BufferRSI);
   
   // Copy Stochastic Data
   // Note: MQL5 Stoch handles a bit differently depending on the mode
   copied += CopyBuffer(handleStoch, 0, 0, bars_total, BufferStochK);
   copied += CopyBuffer(handleStoch, 1, 0, bars_total, BufferStochD);

   return(bars_total);
}

Re: Scalp-Master Oscillator

Posted: Thu Aug 27, 2026 10:36 am
by PTScalper
To adapt this for cTrader, we move from the MQL (MetaQuotes Language) to C# (C-Sharp).

cTrader is very powerful because C# allows for a much cleaner way to handle "nested" indicators. In the code below, I have combined the Fast RSI and Stochastic logic into one single indicator window so it looks and functions exactly like the MT4/MT5 version.

The cTrader Code (C#)

Create a new indicator in cTrader (e.g., Scalp_Master_Osc.cs) and replace the code with the following:

Code: Select all

using System;
using System.Linq;
using cAlgo.Engine;
using cAlgo.Indicators;
using cAlgo._Reports;

namespace cAlgo.Indicators
{
    [Indicator(Brushes.Lime, AnalysisMode.None, Resolution.Any)]
    public class ScalpMasterOsc : Indicator
    {
        // --- Parameters ---
        [Parameter("RSI Period", DefaultValue = 7, Group = "RSI")]
        public int RSIPeriod { get; set; }

        [Parameter("Stoch K Period", DefaultValue = 5, Group = "Stochastic")]
        public int StochKPeriod { get; set; }

        [Parameter("Stoch D Period", DefaultValue = 3, Group = "Stochastic")]
        public int StochDPeriod { get; set; }

        [Parameter("Stoch Slowing", DefaultValue = 3, Group = "Stochastic")]
        public int StochSlowing { get; set; }

        [Parameter("Overbought", DefaultValue = 80, Group = "Levels")]
        public int Overbought { get; set; }

        [Parameter("Oversold", DefaultValue = 20, Group = "Levels")]
        public int Oversold { get; set; }

        // --- Data Series ---
        [Output("Fast RSI", LineColor.Lime, Thickness = 2)]
        public DataSeries RSI_Buffer;

        [Output("Stoch K", LineColor.Red, Thickness = 1)]
        public DataSeries StochK_Buffer;

        [Output("Stoch D", LineColor.White, Thickness = 1)]
        public DataSeries StochD_Buffer;

        private Stochastic_Manual _stoch;
        private RelativeStrengthIndex _rsi;

        protected override void Initialize()
        {
            _rsi = Indicators.RelativeStrengthIndex(RSIPeriod);
            // cTrader's internal Stochastic handles the standard calculation
            _stoch = Indicators.Stochastic(StochKPeriod, StochDPeriod, StochSlowing);
        }

        public override void Calculate(int index)
        {
            // Update RSI Buffer
            RSI_Buffer[index] = _rsi.GetValue(index);

            // Update Stochastic Buffers
            // Note: cTrader's Stochastic returns a collection/array or specific values
            // We map them to our output buffers.
            StochK_Buffer[index] = _stoch.Main.GetValue(index);
            StochD_Buffer[index] = _stoch.Slow.GetValue(index);
        }
    }

    // Internal helper for Stochastic logic if needed, but 
    // cTrader's built-in Stochastic is usually sufficient.
    // I have structured the code above to use the standard cTrader library 
    // so it is highly optimized.
}

Re: Scalp-Master Oscillator

Posted: Thu Aug 27, 2026 10:39 am
by PTScalper
Here is the Pine Script (v5) code. It is designed to be visually clean, with a bold line for the RSI and thinner lines for the Stochastic, making it easy to read on fast timeframes like the 1m or 5m.

Part 1: The Pine Script Code

Create a new indicator in TradingView (Pine Editor) and paste this code:

Code: Select all

//@version=5
indicator("Scalp-Master Oscillator", shorttitle="Scalp-Master", overlay=false)

// --- Inputs ---
// RSI Settings
rsiLen     = input.int(7, "RSI Period", minval=1, group="RSI Settings")
// Stochastic Settings
stochK     = input.int(5, "Stoch K Period", minval=1, group="Stochastic Settings")
stochD     = input.int(3, "Stoch D Period", minval=1, group="Stochastic Settings")
stochS     = input.int(3, "Stoch Slowing", minval=1, group="Stochastic Settings")
// Levels
obLevel    = input.int(80, "Overbought Level", group="Levels")
osLevel    = input.int(20, "Oversold Level", group="Levels")

// --- Calculations ---
// Calculate RSI
rsiValue = ta.rsi(close, rsiLen)

// Calculate Stochastic
// Standard Pine calculation: (close - low) / (high - low) * 100
// The 'stoch' function handles the K and D smoothing
stochRaw = ta.stoch(close, high, low, stochK)
stochK_Val = ta.sma(stochRaw, stochD) // Simple way to get the K value
stochD_Val = ta.sma(stochK_Val, stochS) // The smoothed D value

// --- Plotting ---
// Plot Overbought and Oversold lines
hline(obLevel, "Overbought", color=color.new(color.red, 50), linestyle=hline.style_dashed)
hline(50, "Midline", color=color.new(color.gray, 70), linestyle=hline.style_dotted)
hline(osLevel, "Oversold", color=color.new(color.green, 50), linestyle=hline.style_dashed)

// Plot the Oscillators
// RSI is the bold Lime line
plot(rsiValue, "Fast RSI", color=color.lime, linewidth=3)

// Stochastic are the thinner red and white lines
plot(stochK_Val, "Stoch K", color=color.red, linewidth=1)
plot(stochD_Val, "Stoch D", color=color.white, linewidth=1)

// Background coloring for visual "zones"
fillColor = rsiValue > obLevel ? color.new(color.red, 90) : rsiValue < osLevel ? color.new(color.green, 90) : na
bgcolor(fillColor)