Author: Coders' Guru
FPI-levels

The Fractional Product Inefficiency (FPI) indicator is a specialized financial analysis tool designed to identify hidden imbalances or "inefficiencies" in the foreign exchange market. Unlike standard indicators that look at a single currency pair in isolation, this script employs a mathematical technique to uncover the underlying relationships between three different major currency pairs simultaneously.

How the Logic Works

The core logic of this indicator is based on the principle of triangular arbitrage and currency correlation. It focuses on three specific pairs: EUR/USD, USD/JPY, and EUR/JPY.

In a perfectly efficient market, the price movements of these three pairs should align in a way where their mathematical products remain constant relative to one another. The script works by performing the following calculation for every historical candle:

  1. Data Collection: It simultaneously pulls the closing prices for EUR/USD, USD/JPY, and EUR/JPY.
  2. Mathematical Synthesis: It multiplies the price of EUR/USD by USD/JPY and then divides that result by the price of EUR/JPY.
  3. Inefficiency Detection: By combining these three values into a single "Main" line, the indicator creates a synthetic value.

What This Means for the Trader

The resulting line on your chart represents the "equilibrium" of these three currency pairs. When the market is behaving predictably and efficiently, this line remains relatively stable. However, when there is a sudden, disproportionate move in one currency (for example, a sharp spike in the Yen that isn't fully reflected in the Euro/USD cross), the indicator will react.

Deviations from the norm highlight areas where the market may be overextended or "out of sync." For a trader, these deviations serve as visual cues to identify potential price corrections or reversals, as they point toward moments where the relative value of one currency has become temporarily disconnected from its mathematical relationship with others.

Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
FPI-levels
//+------------------------------------------------------------------+
//|           FPI – Fractional Product Inefficiency                  |
//|                                                          FPI.mq4 |
//|                                         Developed by Coders Guru |
//|                                            http://www.xpworx.com |
//+------------------------------------------------------------------+

#property link      "http://www.xpworx.com"
#property copyright "Coders' Guru" 


#property indicator_separate_window
#property indicator_level1  1.0100
#property indicator_level2  1.0040
#property indicator_level4  1
#property indicator_level5  0.9960
#property indicator_level6  0.9900
#property indicator_buffers 1
#property indicator_color1 Yellow
#property indicator_levelcolor Red



double Main[] , EurUsd[] ,UsdJpy[] ,EurJpy[] ;

//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(4); 
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,Main);
   
   SetIndexBuffer(1,EurUsd);
   SetIndexBuffer(2,UsdJpy);
   SetIndexBuffer(3,EurJpy);

   ArrayInitialize(EurUsd,EMPTY_VALUE);
   ArrayInitialize(UsdJpy,EMPTY_VALUE);
   ArrayInitialize(EurJpy,EMPTY_VALUE);
   ArrayInitialize(Main,EMPTY_VALUE);

   return(0);
  }



//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }

//+------------------------------------------------------------------+
int start()
  {

   ArrayCopySeries(EurUsd,MODE_CLOSE,"EURUSD",Period());
   ArrayCopySeries(UsdJpy,MODE_CLOSE,"USDJPY",Period());
   ArrayCopySeries(EurJpy,MODE_CLOSE,"EURJPY",Period());

   int counted_bars=IndicatorCounted();
   int i = 0;

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   
   for(i=0; i<limit; i++)
   {
       Main[i] = EurUsd[i]* UsdJpy[i]* (1/EurJpy[i]);
   }

   return(0);
  }
//+------------------------------------------------------------------+

Comments