Fx10Setup_v1
Download scriptThis technical indicator is designed to identify potential trading opportunities by analyzing multiple market conditions simultaneously. Rather than relying on a single piece of data, it looks for a "confluence"—a moment where several different mathematical models agree on the direction of the price movement.
Core Logic Overview
The script operates by scanning historical and real-time price data to detect specific patterns. It uses a "multiplier" setting that allows users to scale the sensitivity of these calculations, effectively making the signals faster or slower depending on the desired trading style.
How it Identifies Signals
The logic is divided into two primary directions: Long (Buy) and Short (Sell). For a signal to appear on your chart, the script requires three specific conditions to be met at the same time.
1. Trend Confirmation (Moving Averages)
The first step the script takes is checking the overall trend using two different Moving Averages (fast and slow).
- For an upward move: It confirms that the fast-moving average is currently positioned above the slower one, suggesting positive momentum.
- For a downward move: It confirms that the fast-moving average is below the slower one, suggesting negative momentum.
2. Momentum and Strength (RSI)
Once a trend is identified, the script uses the Relative Strength Index (RSI) to measure the "strength" of that movement.
- Upward: It looks for the RSI to be at a sufficiently high level (indicating strong buying pressure).
- Downward: It looks for the RSI to be at a sufficiently low level (indicating strong selling pressure).
3. Overbought/Oversold & Directional Velocity (Stochastic & MACD)
To ensure the move isn't just a temporary spike, the script checks two additional indicators:
- Stochastic Oscillator: This helps identify where the price sits relative to its recent range. It looks for the main line to be moving in the correct direction relative to its signal line.
- MACD (Moving Average Convergence Divergence): This is used to confirm the velocity of the trend. The script checks if the current MACD value is higher or lower than its own signal line, ensuring that the momentum has enough "push" behind it.
Visual Output
When all three conditions—Trend, Strength, and Velocity—align perfectly, the script places a visual marker on your chart:
- Green Arrows: Appear above the price candles when the logic confirms a potential upward move.
- Red Arrows: Appear below the price candles when the logic confirms a potential downward move.
In simple terms, this tool acts as a filter; it ignores minor market noise and only highlights moments where multiple technical perspectives agree that a significant move is occurring.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
#property copyright "palanka"
#property link ""
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_color2 Red
extern double ParmMult = 2.0; // multiply the standard parameters by this scale factor
int shift = 0;
bool first = true;
int prevbars = 0;
bool RsiUp = false, RsiDown = false;
double signal_long[];
double signal_short[];
bool up = false;
bool down = false;
int init()
{
SetIndexBuffer(0,signal_long);
SetIndexBuffer(1,signal_short);
IndicatorShortName("Fx10Setup");
SetIndexEmptyValue(0, 0.0) ;
SetIndexEmptyValue(1, 0.0) ;
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,233);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,234);
IndicatorDigits(1);
return(0);
}
int deinit()
{
return(0);
}
int start()
{
if (prevbars == Bars)
return(0);
// check for additional bars loading or total reloading
if ((Bars < prevbars) || (Bars - prevbars > 1))
first = true;
prevbars = Bars;
if (first)
{
if (Bars <= 26 * ParmMult)
return(0);
first = false;
}
shift = Bars;
while(shift >= 0)
{
signal_long[shift] = 0.0;
signal_short[shift] = 0.0;
double fastMA = iMA(NULL, 0, 5 * ParmMult, 0, MODE_LWMA, PRICE_CLOSE, shift);
double slowMA = iMA(NULL, 0, 10 * ParmMult, 0, MODE_SMA, PRICE_CLOSE, shift);
if (fastMA > slowMA)
{
RsiUp = iRSI(NULL, 0, 14 * ParmMult, PRICE_CLOSE, shift) >= 55.0;
//and iRSI(p1, 1) > iRSI(p1, 2)
double Stoch0 = iStochastic(NULL, 0, 5*ParmMult, 3*ParmMult, 3*ParmMult, MODE_SMA, PRICE_CLOSE, MODE_MAIN, shift);
// double Stoch1 = iStochastic(NULL, 0, 5*ParmMult, 3*ParmMult, 3*ParmMult, MODE_SMA, PRICE_CLOSE, MODE_MAIN, shift + 1);
double StochSig0 = iStochastic(NULL, 0, 5*ParmMult, 3*ParmMult, 3*ParmMult, MODE_SMA, PRICE_CLOSE, MODE_SIGNAL, shift);
bool StochUp = (Stoch0 > StochSig0);
//and Stoch0 > Stoch1
//and Stoch0 >= StochHigh
double MacdCurrent = iMACD(NULL, 0, 12*ParmMult, 26*ParmMult, 9*ParmMult, PRICE_CLOSE, MODE_MAIN, shift);
// double MacdPrevious = iMACD(NULL, 0, 12*ParmMult, 26*ParmMult, 9*ParmMult, PRICE_CLOSE, MODE_MAIN, shift + 1);
double MacdSig0 = iMACD(NULL, 0, 12*ParmMult, 26*ParmMult, 9*ParmMult, PRICE_CLOSE, MODE_SIGNAL, shift);
bool MacdUp = (MacdCurrent > MacdSig0);
//and MacdCurrent > MacdPrevious
//and MacdCurrent > 50
if (StochUp && RsiUp && MacdUp)
signal_long[shift] = High[shift] + 0.3 / MathPow(10.0, Digits - 1);
}
else if (fastMA < slowMA)
{
RsiDown = iRSI(NULL, 0, 14 * ParmMult, PRICE_CLOSE, shift) <= 45.0;
//and iRSI(p1, 2) > iRSI(p1, 1)
Stoch0 = iStochastic(NULL, 0, 5*ParmMult, 3*ParmMult, 3*ParmMult, MODE_SMA, PRICE_CLOSE, MODE_MAIN, shift);
// double Stoch1 = iStochastic(NULL, 0, 5*ParmMult, 3*ParmMult, 3*ParmMult, MODE_SMA, PRICE_CLOSE, MODE_MAIN, shift + 1);
StochSig0 = iStochastic(NULL, 0, 5*ParmMult, 3*ParmMult, 3*ParmMult, MODE_SMA, PRICE_CLOSE, MODE_SIGNAL, shift);
bool StochDown = (Stoch0 < StochSig0);
//and Stoch0 < Stoch1
//and Stoch0 <= StochLow
MacdCurrent = iMACD(NULL, 0, 12*ParmMult, 26*ParmMult, 9*ParmMult, PRICE_CLOSE, MODE_MAIN, shift);
// double MacdPrevious = iMACD(NULL, 0, 12*ParmMult, 26*ParmMult, 9*ParmMult, PRICE_CLOSE, MODE_MAIN, shift + 1);
MacdSig0 = iMACD(NULL, 0, 12*ParmMult, 26*ParmMult, 9*ParmMult, PRICE_CLOSE, MODE_SIGNAL, shift);
bool MacdDown = (MacdCurrent < MacdSig0);
//and MacdCurrent < MacdPrevious
//and MacdCurrent < 50
if (StochDown && RsiDown && MacdDown)
signal_short[shift] = Low[shift] - 0.3 / MathPow(10.0, Digits - 1);
}
shift--;
}
return(0);
}
Comments