Author: palanka
Fx10Setup

This tool is designed to serve as a visual navigation aid for traders by identifying potential momentum shifts on a price chart. Rather than relying on a single piece of data, it uses a "confluence" logic, meaning it only triggers a signal when multiple different technical indicators agree with each other simultaneously.

The core functionality can be broken down into three main stages:

1. Trend Filtering (The Foundation)

Before looking for specific entry points, the script first determines the overall direction of the market using Moving Averages. It compares a "fast" moving average against a "slow" moving average to establish the prevailing trend:

  • Bullish Bias: If the fast average is above the slow average, the script only looks for upward (long) opportunities.
  • Bearish Bias: If the fast average is below the slow average, the script only looks for downward (short) opportunities.

2. Multi-Indicator Validation

Once a trend direction is established, the script cross-references three specific technical oscillators to confirm that there is enough strength to act on:

  • Relative Strength Index (RSI): This measures the speed and change of price movements. For an upward signal, it checks if the RSI has crossed a specific high-momentum threshold; for a downward signal, it checks if it has dropped below a specific low-momentum level.
  • Stochastic Oscillator: This helps identify where the price is relative to its recent range. The script looks for specific crossovers between the "main" line and the "signal" line to ensure the momentum is moving in the desired direction.
  • MACD (Moving Average Convergence Divergence): This identifies changes in the strength, direction, and momentum of a security. The script verifies that the MACD main value is positioned correctly relative to its signal line.

3. Visual Execution

The final output of this logic is translated into clear visual markers on your chart:

  • Long Signals (Buy): When the trend is up AND the RSI is high enough, AND the Stochastic is moving up, AND the MACD confirms upward momentum, a green arrow appears above the price candle.
  • Short Signals (Sell): When the trend is down AND the RSI is low enough, AND the Stochastic is moving down, AND the MACD confirms downward momentum, a red arrow appears below the price candle.

Customization

The script includes a "Scale Factor" (ParmMult). This allows users to multiply the internal settings of all indicators simultaneously. By adjusting this single value, you can make the logic more sensitive (faster signals) or more conservative (slower, more filtered signals) without having to manually recalculate every individual technical parameter.

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