This tool is designed as a visual trading assistant for the MetaTrader platform, providing clear "buy" and "sell" signals on your charts by analyzing multiple market conditions simultaneously. Rather than relying on just one type of data, it uses a multi-layered confirmation logic to identify high-probability price movements.
How the Logic Works
The script monitors four primary technical indicators to ensure that all conditions align before displaying a signal:
1. Trend Identification (Moving Averages) The foundation of the tool is a comparison between two different Moving Averages (fast and slow).
- When the faster average moves above the slower one, it suggests an upward trend.
- When the faster average drops below the slower one, it suggests a downward trend.
2. Momentum Confirmation (RSI) To ensure that the price isn't just moving randomly but has actual strength behind it, the tool checks the Relative Strength Index (RSI). It looks for specific "strength zones" to confirm that the momentum is sufficiently high in either direction.
3. Overbought/Oversold Analysis (Stochastic Oscillator) The script uses a Stochastic Oscillator to see where the price sits relative to its recent range. It looks for instances where the main line crosses over or under the signal line, helping to identify precise entry moments within a larger trend.
4. Trend Strength & Signaling (MACD) Finally, the Moving Average Convergence Divergence (MACD) is used to validate the overall health of the trend. The tool checks if the current MACD values are positioned favorably against their own signal lines to confirm that the move has enough "weight" to be reliable.
Signal Execution
- Buy Signals (Lime Green Arrows): These appear only when the Moving Averages show an upward trend, the RSI confirms strength, the Stochastic Oscillator shows a bullish crossover, and the MACD signals a positive trend simultaneously.
- Sell Signals (Red Arrows): These appear only when the Moving Averages show a downward trend, the RSI confirms weakness, the Stochastic Oscillator shows a bearish crossover, and the MACD signals a negative trend simultaneously.
Key Features for the User
- Customizable Sensitivity: The script includes a "Scale Factor" parameter. This allows you to speed up or slow down the tool's sensitivity; a higher number makes the indicator more conservative (looking at longer timeframes), while a lower number makes it more reactive to fast price changes.
- Visual Clarity: Instead of cluttered data tables, the script places clean arrows directly on your chart, positioned slightly above or below the candles to provide immediate visual guidance for potential trades.
//+------------------------------------------------------------------+
//| |
//| Copyright © 2000-2007, MetaQuotes Software Corp. |
//| http://www.metaquotes.ru |
//+------------------------------------------------------------------+
#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
extern double del=30;
//----
int shift,ks,kl;
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,0,1);
SetIndexArrow(0,241);
SetIndexStyle(1,DRAW_ARROW,0,1);
SetIndexArrow(1,242);
//
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 && kl==0)
{
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)
{ kl=1;ks=0;
signal_long[shift]=Low[shift] - del*Point;
} else kl=0;
}
else if (fastMA < slowMA && ks==0)
{
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)
{ ks=1;kl=0;
signal_short[shift]=High[shift] + del*Point;
} else ks=0;
}
shift--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments