CHF_CORR_EUR_v2

Download script
Author: Copyright � 2005, Perky_z.
CHF_CORR_EUR_v2

This script is designed as a technical analysis tool for traders who want to monitor the relationship between two specific currency pairs: USD/CHF and EUR/USD. It works by tracking the price movements of the Swiss Franc (CHF) relative to the US Dollar on a very fast, minute-by-minute timeframe to help identify potential trading opportunities in the Euro.

How the Logic Works

The core idea behind this script is "correlation." In forex trading, different currencies often move in relation to one another. This tool specifically watches for significant movements in the USD/CHF pair to suggest a corresponding action in the EUR/USD market.

1. Real-Time Monitoring The script constantly looks at the 1-minute charts of the USD/CHF pair. It captures two specific pieces of data for every minute:

  • The current closing price.
  • The opening price (to determine how much the price moved during that specific minute).

2. Movement Calculation For every new minute, the script calculates the "difference" or the distance traveled by the price. It compares where the price started at the beginning of the minute to where it ended at the close.

3. The Signal Triggers The script is programmed to look for a specific threshold of movement—specifically, a move greater than 6 pips (0.0006).

  • Buy Signal: If the USD/CHF price drops significantly (a negative difference of at least 0.0006), the logic interprets this as a signal to consider a "Buy" position on EUR/USD.
  • Sell Signal: If the USD/CHF price rises significantly (a positive difference of at least 0.0006), the logic interprets this as a signal to consider a "Sell" position on EUR/USD.

4. Notifications Whenever one of these specific price movements occurs, the script provides immediate feedback to the trader in two ways:

  • On-Screen Comments: It updates a text comment on the chart showing the current difference and the recommended action.
  • Alerts: It triggers an audible alert notification to notify the trader instantly that the threshold has been crossed, allowing for faster reaction times in fast-moving markets.

In summary, this tool acts as a "scout." It watches the behavior of the Swiss Franc on a minute-by-minute basis and alerts the user when enough momentum is detected to potentially influence a trade on the Euro.

Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
CHF_CORR_EUR_v2
//+------------------------------------------------------------------+
//|                                   Correlation USDCHF/EURUSD .mq4 |
//|                                  Copyright © 2005, Yuri Makarov. |
//|                                       http://mak.tradersmind.com |
//+------------------------------------------------------------------+
// Correlates  chf prive ON eur 1 min chart
// if chf bar (1 min) is greater than 3 pips it recommends sell/buy eur

#property copyright "Copyright © 2005, Perky_z."
#property link      "Perky_z@yahoo.com"
#include <stdlib.mqh>

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 OrangeRed
//----
extern string Curency = "CHF";
//----
double UsdChf[],UsdChfO[];
double Idx[];
double diff,diff1;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName(Curency);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, Idx);
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void start()
  {
   double dLastBarCLOSE, dLastBarOPEN;
   //I've put the period statement in - this means that
   // you can get close for other periods onto the current chart
   int nBars = ArrayCopySeries(UsdChf, MODE_CLOSE, "USDCHF", PERIOD_M1);
   int LastError = GetLastError(); 
   if(LastError == 4066)
     {
       int lastBars = nBars;
       for( int k = 0; k <10; k++) 
         {
           dLastBarCLOSE = UsdChf[0];
           nBars = ArrayCopySeries(UsdChf, MODE_CLOSE, "USDCHF", PERIOD_M1);
           LastError = GetLastError();
           if(dLastBarCLOSE == UsdChf[0] && lastBars==nBars && LastError == 0) 
               break;
           lastBars = nBars;
         }
     }
   if(LastError != 0)
      {
        Print("Error 001: ArrayCopySeries(): Error == ", ErrorDescription(LastError), "(",
              LastError, "), k == ",k, ", PERIOD_M1, nBars == ", nBars);
        return(0);
      }
//----
   nBars = ArrayCopySeries(UsdChfO, MODE_OPEN, "USDCHF", PERIOD_M1);
   LastError = GetLastError(); 
   if(LastError == 4066)
     {
       lastBars = nBars;
       for(k = 0; k <10; k++) 
         {
           dLastBarOPEN = UsdChf[0];
           nBars = ArrayCopySeries(UsdChfO, MODE_OPEN, "USDCHF", PERIOD_M1);
           LastError = GetLastError();
           if(dLastBarCLOSE == UsdChf[0] && lastBars==nBars && LastError == 0) 
               break;
           lastBars = nBars;
         }
     }
   if(LastError != 0)
      {
        Print("Error 002: ArrayCopySeries(): Error == ", ErrorDescription(LastError), "(",
              LastError, "), k == ",k, ", PERIOD_M1, nBars == ", nBars);
        return(0);
      }
//----
   int counted_bars = IndicatorCounted();
   double USD;
//----
   if(counted_bars < 0) 
       return(-1);
   if(counted_bars > 0) 
       counted_bars--;
   int limit = Bars - counted_bars;
   for(int i = 0; i < limit; i++)
     {
       diff = (UsdChf[i] - UsdChfO[i]);
       diff1 = (UsdChf[i+1] - UsdChfO[i+1]);
       Comment("Before", diff1, "\nnow    ", diff);
       if(Curency == "CHF") 
           Idx[i] = UsdChf[i]; 
       if(diff <= -0.0006 && diff < 0)
         {
           Comment("diff ",diff," Buy eur");
           Alert ("USDCHF ", diff, " Difference BUY EURUSD");
         }
       if(diff >= 0.0006 && diff > 0)  
         {
           Comment("diff ", diff, " Sell eur");
           Alert ("USDCHF ", diff, " Difference SELL EURUSD");
         }
       if(Curency == "CHF") 
           Idx[i] = UsdChf[i]; 
      
     }
  }
//+------------------------------------------------------------------+


Comments