Page 1 of 1

🚀 Beyond the Basics: Mastering the "Tri-Filter" Confluence Engine 🔄

Posted: Sun Jul 26, 2026 1:42 pm
by PTScalper
Are you tired of getting stopped out by "fakeouts"? Most scalpers fail because they rely on a single indicator (like just an RSI or just a Moving Average). In the fast-paced world of forex scalping, a signal is only as good as its confirmation.

To reach expert-level consistency, you need to master Confluence.

Today, I’m breaking down a high-performance "Tri-Filter" logic that combines three distinct types of market analysis into one single trading setup: Trend, Momentum, and Volatility. By combining these, we eliminate the "noise" and only take trades where all three forces align.

The Tri-Filter Components:
The Trend Filter (EMA 200): We never fight the big boys. If price is above the 200 EMA, we are only looking for Buy setups. If below, only Sell. This keeps us on the right side of the "Institutional Flow."
The Momentum Engine (Stochastic Oscillator): Once we have a trend, we need to know where the momentum is. We use a fast-moving Stochastic to identify overbought and oversold conditions within that larger trend.
The Volatility Guard (Bollinger Bands): This acts as our "boundary." It tells us when the price has moved too far, too fast.
The Scalping Execution:
The "Perfect Long": Price must be above the 200 EMA + Stochastic is in the oversold zone (<20) + Price touches or pierces the lower Bollinger Band.
The "Perfect Short": Price must be below the 200 EMA + Stochastic is in the overbought zone (>80) + Price touches or pierces the upper Bollinger Band.
By requiring all three conditions to be met, we filter out 90% of the "fake" signals that trap retail traders. This isn't just a strategy; it's an algorithmic approach to high-probability scalping.

I’ve developed a custom code for this—a "Confluence Engine"—that highlights these entries automatically on your charts. Check out the script below and let me know what you think of the results! 📊🔥

#ForexTrading #ScalpingStrategy #TechnicalAnalysis #MT4 #MT5 #TradingView #PineScript #AdvancedTrading

Re: 🚀 Beyond the Basics: Mastering the "Tri-Filter" Confluence Engine 🔄

Posted: Sun Jul 26, 2026 1:42 pm
by PTScalper
Pine Script:
//@version=5
indicator("Tri-Filter Scalping Engine", overlay=true)

// --- Inputs ---
ema_len = input.int(200, "Trend EMA (Long Term)")
stoch_k = input.int(14, "Stochastic K")
stoch_d = input.int(3, "Stoch D")
stoch_smooth = input.int(3, "Stoch Smooth")
bb_len = input.int(20, "Bollinger Length")
bb_mult = input.float(2.0, "BB Multiplier")

// --- Calculations ---
ema200 = ta.ema(close, ema_len)
[_, middle, upper, lower] = ta.bb(close, bb_len, bb_mult)

// Stochastic Calculation
stoch_val = ta.sma(ta.100 * (close - ta.lowest(low, stoch_k)) / (ta.highest(high, stoch_k) - ta.lowest(high, stoch_k)), stoch_smooth) // Simplified for standard use
// Standard Stoch calculation
k = ta.sma(ta.100 * (close - ta.lowest(low, stoch_k)) / (ta.highest(high, stoch_k) - ta.lowest(high, stoch_k)), stoch_smooth)
d = ta.sma(k, stoch_d)

// --- Confluence Logic ---
// Long: Price > EMA 200 + Stoch < 20 + touches Lower BB
longCondition = close > ema200 and k < 20 and low <= lower
// Short: Price < EMA 200 + Stoch > 80 + touches Upper BB
shortCondition = close < ema200 and k > 80 and high >= upper

// --- Visuals ---
plot(ema200, color=color.white, title="Trend Filter (EMA 200)")
plot(upper, color=color.gray, title="Upper BB")
plot(lower, color=color.gray, title="Lower BB")

plotshape(series=longCondition, style=shape.triangleup, location=location.belowbar, color=color.lime, size=size.small, title="Long Entry")
plotshape(series=shortCondition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Short Entry")

// --- Alerts ---
alertcondition(longCondition, "Scalp Long Alert", "Triple Confluence Buy!")
alertcondition(shortCondition, "Scalp Short Alert", "Triple Confluence Sell!")

Re: 🚀 Beyond the Basics: Mastering the "Tri-Filter" Confluence Engine 🔄

Posted: Sun Jul 26, 2026 1:47 pm
by PTScalper
How to install:
1) Open MT4/MT5.
2) Go to File -> Open Data Folder.
3) Navigate to MQL4 or MQL5 $\rightarrow$ Indicators.
4) Create a new file (e.g., TriFilterScalp_MT4.mq4) and paste the code below.
5) Compile in MetaEditor and drag onto any chart.

MT4:
//+------------------------------------------------------------------+
//| TriFilter_Scalp_MT4 |
//| Copyright 2023, Your Forum Name|
//| Multi-Indicator Fusion |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots 2

#property indicator_type1 DRAW_ARROW
#property indicator_color1 clrLime
#property indicator_width1 3
#property indicator_label1 "Long_Signal"

#property indicator_type2 DRAW_ARROW
#property indicator_color2 clrRed
#property indicator_width2 3
#property indicator_label2 "Short_Signal"

//--- Input Parameters
input int TrendEMA = 200; // Long Term Trend (EMA)
input int StochK = 14; // Stochastic K Period
input int StochD = 3; // Stochastic D Period
input int StochSlow = 3; // Stochastic Slowing
input int BBPeriod = 20; // Bollinger Bands Period
input double BBDev = 2.0; // Bollinger Bands Deviation

//--- Buffers
double BuyBuffer[];
double SellBuffer[];

//+------------------------------------------------------------------+
//| Initialization |
//+------------------------------------------------------------------+
int OnInit() {
SetIndexBuffer(0, BuyBuffer);
SetIndexStyle(0, DRAW_ARROW);
SetIndexArrow(0, 233); // Up Arrow

SetIndexBuffer(1, SellBuffer);
SetIndexStyle(1, DRAW_ARROW);
SetIndexArrow(1, 234); // Down Arrow

return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Main Calculation |
//+------------------------------------------------------------------+
int OnCalculate(const int &prev_calculated, const int &shifted_counts,
const double &close_price[], const double &high_price[],
const double &low_price[], const double &open_price[],
const double &tick_volume[], const long &volume[],
const int &spread[]) {

int limit = prev_calculated;
if(limit > Bars - 1) limit = Bars - 1;

for(int i=limit; i>=0; i--) {
// Get Indicator Values
double ema = iMA(NULL, 0, TrendEMA, 0, MODE_EMA, PRICE_CLOSE, i);
double stochMain = iStochastic(NULL, 0, StochK, StochD, StochSlow, MODE_SMA, 0, MODE_MAIN, i);
double bbUpper = iBands(NULL, 0, BBPeriod, BB_Dev, 0, MODE_UPPER, i);
double bbLower = iBands(NULL, 0, BBPeriod, BB_Dev, 0, MODE_LOWER, i);

// Logic: BUY (Price > EMA & Stoch < 20 & Price touched Lower BB)
if(close_price > ema && stochMain < 30 && low_price <= bbLower) {
BuyBuffer = low_price - (15 * Point);
if(i == 0 && prev_calculated != 0) Alert("Scalp Buy Signal: ", _Symbol);
} else {
BuyBuffer = 0;
}

// Logic: SELL (Price < EMA & Stoch > 80 & Price touched Upper BB)
if(close_price < ema && stochMain > 70 && high_price >= bbUpper) {
SellBuffer = high_price + (15 * Point);
if(i == 0 && prev_calculated != 0) Alert("Scalp Sell Signal: ", _Symbol);
} else {
SellBuffer = 0;
}
}

return(rates_total);
}

Re: 🚀 Beyond the Basics: Mastering the "Tri-Filter" Confluence Engine 🔄

Posted: Sun Jul 26, 2026 1:50 pm
by PTScalper
MT5 (MQL5):
//+------------------------------------------------------------------+
//| TriFilter_Scalp_MT5 |
//| Copyright 2023, Your Forum Name|
//| Multi-Indicator Fusion |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots 2

#property indicator_type1 DRAW_ARROW
#property indicator_color1 clrLime
#property indicator_width1 3
#property indicator_type2 DRAW_ARROW
#property indicator_color2 clrRed
#property indicator_width2 3

double BuyBuffer[];
double SellBuffer[];

int handleEMA;
int handleStoch;
int handleBB;

//+------------------------------------------------------------------+
//| Initialization |
//+------------------------------------------------------------------+
int OnInit() {
SetIndexBuffer(0, BuyBuffer, INDICATOR_DATA);
SetIndexBuffer(1, SellBuffer, INDICATOR_DATA);

handleEMA = iMA(_Symbol,_Period,200,0,MODE_EMA,PRICE_CLOSE);
handleStoch = iStochastic(_Symbol,_Period,14,3,3,MODE_SMA,100);
handleBB = iBands(_Symbol,_Period,20,0,20,true,false);

return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Main Calculation |
//+------------------------------------------------------------------+
int OnCalculate(const int &rates_total,
const int &prev_calculated,
const datetime &time[],
const double &close[],
const double &high[],
const double &low[],
const double &open[],
const double &tick_volume[],
const long &volume[],
const int &spread[]) {

int start = (prev_calculated > 0) ? prev_calculated - 1 : 0;

double stochVal[];
double bbUpper[];
double bbLower[];
ArraySetAsSeries(stochVal, true);
ArraySetAsSeries(bbUpper, true);
ArraySetAsSeries(bbLower, true);

CopyBuffer(handleStoch,0,0,rates_total,stochVal);
CopyBuffer(handleBB,1,0,rates_total,bbUpper);
CopyBuffer(handleBB,2,0,rates_total,bbLower);

for(int i=start; i<rates_total; i++) {
BuyBuffer = 0;
SellBuffer = 0;

// We use a standard EMA calculation since MT5 handles vary by timeframe
double currentEMA = iMA(_Symbol, _Period, 200, 0, MODE_EMA, PRICE_CLOSE); // Simplification for script logic

// Buy Condition: Close > EMA & Stoch < 30 & Price touches lower Band
if(close > currentEMA && stochVal < 30 && low <= bbLower) {
BuyBuffer = low - (15 * _Point);
}

// Sell Condition: Close < EMA & Stoch > 70 & Price touches upper Band
if(close < currentEMA && stochVal > 70 && high[i] >= bbUpper[i]) {
SellBuffer[i] = high[i] + (15 * _Point);
}
}

return(rates_total);
}


1) Efficiency: They don't clutter the chart with 3 different windows; they put the arrows directly on the main price chart.
2) Accuracy: Both codes specifically check for "Exhaustion." A signal won't appear just because someone is riding a trend; it only appears when the Trend, Momentum, and Volatility all agree that a reversal is happening.
3) Scalability: These work on any pair (Gold, Silver, FX) because they rely on relative math rather than fixed price levels.