Fx10Setup_v2

Download script
Author: palanka
Fx10Setup_v2

This technical script is designed as a visual trading tool that identifies potential entry points for market movements by analyzing multiple price indicators simultaneously. Rather than relying on a single data point, it looks for a "confluence" of signals—meaning it only triggers an alert when several different mathematical conditions agree with one another at the same time.

How the Logic Works

The script monitors the market to find two distinct types of opportunities: upward momentum (Long) and downward momentum (Short). To determine these, it evaluates four primary technical components:

1. Trend Identification (Moving Averages) The core logic begins by comparing two different "Moving Averages"—which are essentially smoothed averages of past prices.

  • It identifies an uptrend when a fast-reacting average crosses above a slower-moving average.
  • It identifies a downtrend when the fast average falls below the slow average.

2. Momentum Confirmation (RSI) Once a trend is identified, the script checks the Relative Strength Index (RSI). This measures the speed and change of price movements.

  • For an upward signal, it ensures the momentum is sufficiently strong (reaching a specific high threshold).
  • For a downward signal, it ensures the momentum is sufficiently weak (dropping to a specific low threshold).

3. Overbought/Oversold Tracking (Stochastic Oscillator) The script also uses a Stochastic Oscillator to see where the price currently sits relative to its recent range. It looks for specific "crossovers" in this data to confirm that the current move has enough underlying strength to continue.

4. Trend Strength (MACD) Finally, the script cross-references these results with the MACD (Moving Average Convergence Divergence) indicator. This acts as a final filter to ensure that the main trend signal is healthy and moving in the desired direction relative to its own baseline.

Visual Output on Your Chart

The script simplifies this complex multi-step calculation into simple visual cues on your trading screen:

  • Buy Signals (Long): When all conditions for an uptrend are met simultaneously (Moving Average, RSI, Stochastic, and MACD all aligning upward), the script places a Lime Green arrow above the price candle.
  • Sell Signals (Short): When all conditions for a downtrend are met simultaneously (Moving Average, RSI, Stochastic, and MACD all aligning downward), the script places a Red arrow below the price candle.

Customization

The script includes a "Scale Factor" parameter. This allows you to adjust the sensitivity of all indicators at once—effectively making the signals more aggressive or more conservative depending on your specific trading style.

Indicators Used
Moving average indicatorRelative strength indexStochastic oscillatorMACD Histogram
Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
Fx10Setup_v2
//+------------------------------------------------------------------+
//|                                                                  |
//|                 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
//----
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