Here's a breakdown of what this MetaTrader script does, explained in a way that someone without programming knowledge can understand:
This script is designed to calculate and display a custom indicator on a currency chart. Think of it as a specialized tool that analyzes the relationships between three different currency pairs and shows the result as a line on the chart. The script refers to this indicator as "FPI," which stands for Fractional Product Inefficiency.
Here's how it works, step by step:
- Data Collection: The script first identifies three specific currency pairs: EURUSD (Euro vs. US Dollar), USDCHF (US Dollar vs. Swiss Franc), and EURCHF (Euro vs. Swiss Franc). It then gathers the closing prices for each of these pairs over a certain period of time (the "Period()" means the time frame you're viewing on the chart, like 1 minute, 1 hour, or 1 day). Imagine it's collecting the "snapshot" price of each currency pair at the end of each time period on the chart.
- Calculation: This is where the "magic" happens. The script takes the closing price of the first currency pair (EURUSD), multiplies it by the closing price of the second currency pair (USDCHF), and then divides the result by the closing price of the third currency pair (EURCHF). It performs this calculation for each point in time on the chart.
- The underlying idea is that there should be some kind of equilibrium in the relation of those pairs. When one of the pairs goes out of this equilibrium a trading opportunity could arise.
- Display: Finally, the script plots the result of this calculation as a yellow line on a separate window in MetaTrader. This line is the "FPI" indicator. It also draws a horizontal grey line at the value of 1.0 to provide a reference point on the chart. The purpose is to visually represent the calculated value over time, allowing traders to analyze the relationship between the chosen currency pairs.
In summary, the script calculates a custom value based on the prices of three currency pairs and displays it as an indicator on a chart. Traders can then use this indicator as part of their strategy for analyzing currency price movements.
Miscellaneous
2
Views
0
Downloads
0
Favorites
FPI
//+------------------------------------------------------------------+
//| MODIFIED BY AVERY T. HORTON, JR AKA THERUMPLEDONE |
//|
// FPI DEVELOPED MY MICHAL KRESLIK WWW.KRESLIK.COM |
//| 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_buffers 1
#property indicator_color1 Yellow
#property indicator_level1 1.0
#property indicator_levelcolor DimGray
#property indicator_levelwidth 1
#property indicator_levelstyle 0
extern string iPair1 = "EURUSD" ;
extern string iPair2 = "USDCHF" ;
extern string iPair3 = "EURCHF" ;
double Main[] , PAIR1[] ,PAIR2[] ,PAIR3[] ;
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(4);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Main);
SetIndexBuffer(1,PAIR1);
SetIndexBuffer(2,PAIR2);
SetIndexBuffer(3,PAIR3);
ArrayInitialize(PAIR1,EMPTY_VALUE);
ArrayInitialize(PAIR2,EMPTY_VALUE);
ArrayInitialize(PAIR3,EMPTY_VALUE);
ArrayInitialize(Main,EMPTY_VALUE);
return(0);
}
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
int start()
{
ArrayCopySeries(PAIR1,MODE_CLOSE,iPair1,Period());
ArrayCopySeries(PAIR2,MODE_CLOSE,iPair2,Period());
ArrayCopySeries(PAIR3,MODE_CLOSE,iPair3,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] = PAIR1[i]* PAIR2[i]* (1/PAIR3[i]);
}
return(0);
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---