DavidF_Hedge_chart

Download script
Author: Copyright � 2006, MetaQuotes Software Corp.
DavidF_Hedge_chart

This script is designed as a visual financial analysis tool for traders who want to monitor the relationship between three specific currency pairs: EUR/USD, USD/CHF, and EUR/CHF. Its primary purpose is to calculate a synthetic value known as the FPI (Full Price Index) in real-time and display the current market levels directly on the trading chart.

How it Works

The tool operates by constantly pulling live market data for three different currency instruments simultaneously. Instead of just looking at one graph, it gathers the "Bid" or "Ask" prices from:

  • EUR/USD
  • USD/CHF
  • EUR/CHF

The Core Logic (FPI Calculation)

The script performs a mathematical cross-calculation to determine the FPI. It takes the price of the EUR/USD pair, multiplies it by the price of the USD/CHF pair, and then divides that result by the price of the EUR/CHF pair.

By performing this specific calculation, the tool helps traders identify the "true" underlying value or equilibrium between these three currencies, stripping away some of the immediate fluctuations of individual pairs to show a broader market relationship.

Visual Display and Feedback

To make this information easy to read at a glance, the script provides two types of visual feedback:

  1. Dynamic Horizontal Lines: The script automatically draws three solid horizontal lines on your chart. Each line represents one of the currency pairs, distinguished by different colors (Dark Orange, Royal Blue, and Lawn Green). As the market moves, these lines shift in real-time to stay pinned to the current price of each pair.
  2. On-Screen Dashboard: In the corner of the chart, the script generates a text summary. This provides you with the exact numerical values for:
    • The calculated FPI value.
    • The current price of EUR/USD.
    • The current price of USD/CHF.
    • The current price of EUR/CHF.

Summary for the User

Essentially, this tool acts as a multi-currency dashboard. It eliminates the need to switch between different tabs or windows to see how these three pairs are performing relative to one another. It consolidates that information into one view, highlighting the "Full Price Index" to help you make more informed decisions on currency correlations.

10 Views
0 Downloads
0 Favorites
DavidF_Hedge_chart
//+------------------------------------------------------------------+
//|                                                 DavidF_Hedge.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

// INFo: http://kreslik.com/forums/viewtopic.php?t=307&postdays=0&postorder=asc&start=0
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorShortName("Hedge EUR/USD/CHF chart");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   if(counted_bars<100) return;
//----
   int i;
   double EUR, USD, CHF, FPI;
   
    RefreshRates();
    
    EUR = MarketInfo("EURUSD",MODE_BID);
    USD = MarketInfo("USDCHF",MODE_BID);     
    CHF = MarketInfo("EURCHF",MODE_ASK);
    
    FPI = EUR * USD * (1/ CHF);

    ObjectDelete("EURUSD");
    ObjectDelete("USDCHF");
    ObjectDelete("EURCHF");


    ObjectCreate("EURUSD", OBJ_HLINE, 0, Time[0], EUR);
    ObjectSet("EURUSD", OBJPROP_STYLE, STYLE_SOLID);
    ObjectSet("EURUSD", OBJPROP_COLOR, DarkOrange);
   

    ObjectCreate("USDCHF", OBJ_HLINE, 0, Time[0], USD);
    ObjectSet("USDCHF", OBJPROP_STYLE, STYLE_SOLID);
    ObjectSet("USDCHF", OBJPROP_COLOR, RoyalBlue);
   

    ObjectCreate("EURCHF", OBJ_HLINE, 0, Time[0], CHF);
    ObjectSet("EURCHF", OBJPROP_STYLE, STYLE_SOLID);
    ObjectSet("EURCHF", OBJPROP_COLOR, LawnGreen);
   
   
   Comment(
    "\n FPI: ",     DoubleToStr(FPI,6),
    "\n EUR/USD: ", DoubleToStr(EUR,4),
    "\n USD/CHF: ", DoubleToStr(USD,4),
    "\n EUR/CHF: ", DoubleToStr(CHF,4));

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

Comments