Klasternaya Mashka
Download scriptThe "Complex Mashka" script is a sophisticated technical analysis tool designed for the MetaTrader 4 platform. Its primary purpose is to provide traders with a multi-dimensional view of currency movements by aggregating data from multiple different currency pairs into a single, cohesive visual indicator.
Instead of looking at a single asset in isolation (such as just the EUR/USD pair), this script performs a "basket" analysis. It evaluates the underlying strength and trends of major currencies—specifically the Euro (EUR), British Pound (GBP), New Zealand Dollar (NZD), Swiss Franc (CHF), and Japanese Yen (JPY)—simultaneously to determine how they are interacting with one another across the global market.
Key Functional Logic:
1. Dynamic Timeframe Adaptation The script is designed to be "smart" regarding the timeframes a trader uses. It contains internal settings that automatically adjust its calculation periods based on whether you are viewing a 1-minute chart, a 4-hour chart, or a monthly chart. This ensures that the indicator remains relevant and smooth regardless of the zoom level of your trading screen.
2. Cross-Currency Correlation Engine The core logic involves calculating specific performance metrics for different currency groups. For each major currency (like the USD or JPY), the script looks at several different pairs involving that currency. It measures the relative "distance" between short-term and long-term moving averages across these pairs. By summing these differences, it creates a composite value that represents the momentum of that specific currency relative to the rest of the market.
3. Custom Asset Mapping The script identifies which specific currency pair you currently have open on your chart (e.g., EURGBP or USDJPY). Once identified, it calculates a unique "Mashka" value by:
- Gathering the weighted performance of the two currencies in that pair.
- Calculating a standard Moving Average for the current asset.
- Combining these data points into a final calculation that factors in price action (Highs, Lows, and Closes) and a user-defined sensitivity coefficient.
4. Visual Output The final result is plotted as a single line on your chart window. This line represents a "Complex" moving average—one that is influenced not just by the immediate price of the asset you are watching, but by the broader structural trends of the entire currency basket it belongs to.
In essence, this tool helps traders filter out "noise" by showing them the broader trend of the currencies involved, providing a more holistic view of market sentiment than a standard moving average could offer on its own.
//+------------------------------------------------------------------+
//| Complex Mashka.mq4 |
//| Copyright © 2006, Matist Krusoe. |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Matist Krusoe."
#property link ""
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
//---- indicator buffers
extern double Amplitude = 1;
extern double Sensitive = 1;
extern double KlasternCoff = 4;
double KlasternayaMashka[];
int MashkaPeriod;
//---- parameters
// for monthly
int mn_per = 12;
int mn_fast = 3;
// for weekly
int w_per = 9;
int w_fast = 3;
// for daily
int d_per = 5;
int d_fast = 3;
// for H4
int h4_per = 12;
int h4_fast = 2;
// for H1
int h1_per = 24;
int h1_fast = 8;
// for M30
int m30_per = 16;
int m30_fast = 2;
// for M15
int m15_per = 16;
int m15_fast = 4;
// for M5
int m5_per = 12;
int m5_fast = 3;
// for M1
int m1_per = 30;
int m1_fast = 10;
//----
int CountedBars;
/// Initialization function //
int init()
{
string short_name = "KM";
int draw_begin=MashkaPeriod-1;
IndicatorShortName(short_name);
SetIndexStyle(0,DRAW_LINE);
//---- indicator buffers mapping
SetIndexBuffer(0, KlasternayaMashka);
//---- drawing settings
SetIndexDrawBegin(0,draw_begin);
SetIndexLabel(0,"Klasternaya Mashka");
//---- initialization done
return(0);
}
int start(){
int limit;
int Price=6;
int Mode=3;
double OPEN,HIGH,LOW,CLOSE,BAZZA;
limit=Bars-CountedBars;
int per1,per2;
// Indicator Period
switch(Period())
{
case 1: per1 = m1_per; per2 = m1_fast; break;
case 5: per1 = m5_per; per2 = m5_fast; break;
case 15: per1 = m15_per;per2 = m15_fast; break;
case 30: per1 = m30_per;per2 = m30_fast; break;
case 60: per1 = h1_per; per2 = h1_fast; break;
case 240: per1 = h4_per; per2 = h4_fast; break;
case 1440: per1 = d_per; per2 = d_fast; break;
case 10080: per1 = w_per; per2 = w_fast; break;
case 43200: per1 = mn_per; per2 = mn_fast; break;
}
/* switch(Period())
{
case 1: MashkaPeriod = 30; break; // m1
case 5: MashkaPeriod = 12; break; // m5
case 15: MashkaPeriod = 16; break; // m15
case 30: MashkaPeriod = 16; break; // m30
case 60: MashkaPeriod = 24; break; // h1
case 240: MashkaPeriod = 12; break; // h4
case 1440: MashkaPeriod = 5; break; // daily
case 10080: MashkaPeriod = 9; break; // weekly
case 43200: MashkaPeriod = 12; break; // mountly
}*/
per1*=Amplitude*Sensitive;
per2*=Sensitive;
MashkaPeriod = per1;
if(Bars<=MashkaPeriod) return(0);
CountedBars=IndicatorCounted();
// Initial Zero
if(CountedBars<1)
{
for(int k=1; k<=MashkaPeriod; k++) KlasternayaMashka[Bars-k]=0;
}
// ïîñëåäíèå áûðà áóäóò ïåðåñ÷èòàíû
if(CountedBars>0) CountedBars--;//-=250;
if(Bars<=MashkaPeriod) return(0);
/// Garnd Circle //
for(int i=0; i<limit; i++){
if (Symbol() == "EURUSD"){
OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);
HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);
LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("EURUSD",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "EURGBP"){
OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-GBP(Mode,PRICE_OPEN,i,per1,per2);
HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-GBP(Mode,PRICE_HIGH,i,per1,per2);
LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-GBP(Mode,PRICE_LOW,i,per1,per2);
CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-GBP(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("EURGBP",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "EURCHF"){
OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-CHF(Mode,PRICE_OPEN,i,per1,per2);
HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-CHF(Mode,PRICE_HIGH,i,per1,per2);
LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-CHF(Mode,PRICE_LOW,i,per1,per2);
CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-CHF(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("EURCHF",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "EURJPY"){
OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("EURJPY",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "GBPUSD"){
OPEN=GBP(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);
HIGH=GBP(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);
LOW=GBP(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
CLOSE=GBP(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("GBPUSD",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "GBPCHF"){
OPEN=GBP(Mode,PRICE_OPEN,i,per1,per2)-CHF(Mode,PRICE_OPEN,i,per1,per2);
HIGH=GBP(Mode,PRICE_HIGH,i,per1,per2)-CHF(Mode,PRICE_HIGH,i,per1,per2);
LOW=GBP(Mode,PRICE_LOW,i,per1,per2)-CHF(Mode,PRICE_LOW,i,per1,per2);
CLOSE=GBP(Mode,PRICE_CLOSE,i,per1,per2)-CHF(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("GBPCHF",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "GBPJPY"){
OPEN=GBP(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
HIGH=GBP(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
LOW=GBP(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
CLOSE=GBP(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("GBPJPY",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "USDCHF"){
OPEN=USD(Mode,PRICE_OPEN,i,per1,per2)-CHF(Mode,PRICE_OPEN,i,per1,per2);
HIGH=USD(Mode,PRICE_HIGH,i,per1,per2)-CHF(Mode,PRICE_HIGH,i,per1,per2);
LOW=USD(Mode,PRICE_LOW,i,per1,per2)-CHF(Mode,PRICE_LOW,i,per1,per2);
CLOSE=USD(Mode,PRICE_CLOSE,i,per1,per2)-CHF(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("USDCHF",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "USDJPY"){
OPEN=USD(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
HIGH=USD(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
LOW=USD(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
CLOSE=USD(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("USDJPY",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "CHFJPY"){
OPEN=CHF(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
HIGH=CHF(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
LOW=CHF(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
CLOSE=CHF(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("CHFJPY",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "NZDUSD"){
OPEN=NZD(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);
HIGH=NZD(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);
LOW=NZD(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
CLOSE=NZD(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("NZDUSD",0,MashkaPeriod,0,Mode,Price,i);
}
KlasternayaMashka[i] = BAZZA*(1 + (OPEN+HIGH+LOW+CLOSE)/KlasternCoff);
}
return(0);
}
///////////////////////////////////////////////////////
double USD(int Mode, int Price, int i, int per1, int per2)
{
return(
(iMA("EURUSD",0,per1,0,Mode,Price,i)-
iMA("EURUSD",0,per2,0,Mode,Price,i))/iMA("EURUSD",0,per1,0,Mode,Price,i)
+
(iMA("GBPUSD",0,per1,0,Mode,Price,i)-
iMA("GBPUSD",0,per2,0,Mode,Price,i))/iMA("GBPUSD",0,per1,0,Mode,Price,i)
+
(iMA("NZDUSD",0,per1,0,Mode,Price,i)-
iMA("NZDUSD",0,per2,0,Mode,Price,i))/iMA("NZDUSD",0,per1,0,Mode,Price,i)
+
(iMA("USDCHF",0,per2,0,Mode,Price,i)-
iMA("USDCHF",0,per1,0,Mode,Price,i))/iMA("USDCHF",0,per1,0,Mode,Price,i)
+
(iMA("USDJPY",0,per2,0,Mode,Price,i)-
iMA("USDJPY",0,per1,0,Mode,Price,i))/iMA("USDJPY",0,per1,0,Mode,Price,i)
);
}
double NZD(int Mode, int Price, int i, int per1, int per2){
return(
(iMA("NZDUSD",0,per2,0,Mode,Price,i)-
iMA("NZDUSD",0,per1,0,Mode,Price,i))/iMA("NZDUSD",0,per1,0,Mode,Price,i)
+
(iMA("GBPNZD",0,per2,0,Mode,Price,i)-
iMA("GBPNZD",0,per1,0,Mode,Price,i))/iMA("GBPNZD",0,per1,0,Mode,Price,i)
+
(iMA("NZDCHF",0,per1,0,Mode,Price,i)-
iMA("NZDCHF",0,per2,0,Mode,Price,i))/iMA("NZDCHF",0,per1,0,Mode,Price,i)
+
(iMA("EURNZD",0,per1,0,Mode,Price,i)-
iMA("EURNZD",0,per2,0,Mode,Price,i))/iMA("EURNZD",0,per1,0,Mode,Price,i)
+
(iMA("NZDJPY",0,per2,0,Mode,Price,i)-
iMA("NZDJPY",0,per1,0,Mode,Price,i))/iMA("NZDJPY",0,per1,0,Mode,Price,i)
);
}
double EUR(int Mode, int Price, int i, int per1, int per2){
return(
(iMA("EURUSD",0,per2,0,Mode,Price,i)-
iMA("EURUSD",0,per1,0,Mode,Price,i))/iMA("EURUSD",0,per1,0,Mode,Price,i)
+
(iMA("EURGBP",0,per2,0,Mode,Price,i)-
iMA("EURGBP",0,per1,0,Mode,Price,i))/iMA("EURGBP",0,per1,0,Mode,Price,i)
+
(iMA("EURCHF",0,per2,0,Mode,Price,i)-
iMA("EURCHF",0,per1,0,Mode,Price,i))/iMA("EURCHF",0,per1,0,Mode,Price,i)
+
(iMA("EURNZD",0,per2,0,Mode,Price,i)-
iMA("EURNZD",0,per1,0,Mode,Price,i))/iMA("EURNZD",0,per1,0,Mode,Price,i)
+
(iMA("EURJPY",0,per2,0,Mode,Price,i)-
iMA("EURJPY",0,per1,0,Mode,Price,i))/iMA("EURJPY",0,per1,0,Mode,Price,i)
);
}
double GBP(int Mode, int Price, int i, int per1, int per2){
return(
(iMA("GBPUSD",0,per2,0,Mode,Price,i)-
iMA("GBPUSD",0,per1,0,Mode,Price,i))/iMA("GBPUSD",0,per1,0,Mode,Price,i)
+
(iMA("EURGBP",0,per1,0,Mode,Price,i)-
iMA("EURGBP",0,per2,0,Mode,Price,i))/iMA("EURGBP",0,per1,0,Mode,Price,i)
+
(iMA("GBPCHF",0,per2,0,Mode,Price,i)-
iMA("GBPCHF",0,per1,0,Mode,Price,i))/iMA("GBPCHF",0,per1,0,Mode,Price,i)
+
(iMA("GBPNZD",0,per2,0,Mode,Price,i)-
iMA("GBPNZD",0,per1,0,Mode,Price,i))/iMA("GBPNZD",0,per1,0,Mode,Price,i)
+
(iMA("GBPJPY",0,per2,0,Mode,Price,i)-
iMA("GBPJPY",0,per1,0,Mode,Price,i))/iMA("GBPJPY",0,per1,0,Mode,Price,i)
);
}
double CHF(int Mode, int Price, int i, int per1, int per2){
return(
(iMA("USDCHF",0,per1,0,Mode,Price,i)-
iMA("USDCHF",0,per2,0,Mode,Price,i))/iMA("USDCHF",0,per1,0,Mode,Price,i)
+
(iMA("EURCHF",0,per1,0,Mode,Price,i)-
iMA("EURCHF",0,per2,0,Mode,Price,i))/iMA("EURCHF",0,per1,0,Mode,Price,i)
+
(iMA("GBPCHF",0,per1,0,Mode,Price,i)-
iMA("GBPCHF",0,per2,0,Mode,Price,i))/iMA("GBPCHF",0,per1,0,Mode,Price,i)
+
(iMA("NZDCHF",0,per1,0,Mode,Price,i)-
iMA("NZDCHF",0,per2,0,Mode,Price,i))/iMA("NZDCHF",0,per1,0,Mode,Price,i)
+
(iMA("CHFJPY",0,per2,0,Mode,Price,i)-
iMA("CHFJPY",0,per1,0,Mode,Price,i))/iMA("CHFJPY",0,per1,0,Mode,Price,i)
);
}
double JPY(int Mode, int Price, int i, int per1, int per2){
return(
(iMA("USDJPY",0,per1,0,Mode,Price,i)-
iMA("USDJPY",0,per2,0,Mode,Price,i))/iMA("USDJPY",0,per1,0,Mode,Price,i)
+
(iMA("EURJPY",0,per1,0,Mode,Price,i)-
iMA("EURJPY",0,per2,0,Mode,Price,i))/iMA("EURJPY",0,per1,0,Mode,Price,i)
+
(iMA("GBPJPY",0,per1,0,Mode,Price,i)-
iMA("GBPJPY",0,per2,0,Mode,Price,i))/iMA("GBPJPY",0,per1,0,Mode,Price,i)
+
(iMA("NZDJPY",0,per1,0,Mode,Price,i)-
iMA("NZDJPY",0,per2,0,Mode,Price,i))/iMA("NZDJPY",0,per1,0,Mode,Price,i)
+
(iMA("CHFJPY",0,per1,0,Mode,Price,i)-
iMA("CHFJPY",0,per2,0,Mode,Price,i))/iMA("CHFJPY",0,per1,0,Mode,Price,i)
);
}
//+------------------------------------------------------------------+ */
/*
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
int MashkaPeriod;
//---- indicator buffers
double ComplexMashka[];
//---- parameters
// for monthly
int mn_per = 12;
int mn_fast = 3;
// for weekly
int w_per = 9;
int w_fast = 3;
// for daily
int d_per = 5;
int d_fast = 3;
// for H4
int h4_per = 12;
int h4_fast = 2;
// for H1
int h1_per = 24;
int h1_fast = 8;
// for M30
int m30_per = 16;
int m30_fast = 2;
// for M15
int m15_per = 16;
int m15_fast = 4;
// for M5
int m5_per = 12;
int m5_fast = 3;
// for M1
int m1_per = 30;
int m1_fast = 10;
//----
int CountedBars;
//+------------------------------------------------------------------+
//| Initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name = "SCoMA";
int draw_begin=MashkaPeriod-1;
IndicatorShortName(short_name);
SetIndexStyle(0,DRAW_LINE);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//---- indicator buffers mapping
SetIndexBuffer(0,ComplexMashka);
//---- drawing settings
SetIndexDrawBegin(0,draw_begin);
SetIndexLabel(0,"Tenkan Sen");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start(){
int limit;
int Price=6;
int Mode=3;
double OPEN,HIGH,LOW,CLOSE,BAZZA;
if(Bars<=MashkaPeriod) return(0);
CountedBars=IndicatorCounted();
//---- ïðîâåðêà íà âîçìîæíûå îøèáêè
if (CountedBars<0) return(-1);
//---- ïîñëåäíèå áûðà áóäóò ïåðåñ÷èòàíû
if(CountedBars>0) CountedBars--;//=250;
limit=Bars-CountedBars;
int per1,per2;
//---- indicator period
switch(Period())
{
case 1: per1 = m1_per; per2 = m1_fast; break;
case 5: per1 = m5_per; per2 = m5_fast; break;
case 15: per1 = m15_per;per2 = m15_fast; break;
case 30: per1 = m30_per;per2 = m30_fast; break;
case 60: per1 = h1_per; per2 = h1_fast; break;
case 240: per1 = h4_per; per2 = h4_fast; break;
case 1440: per1 = d_per; per2 = d_fast; break;
case 10080: per1 = w_per; per2 = w_fast; break;
case 43200: per1 = mn_per; per2 = mn_fast; break;
}
/* switch(Period())
{
case 1: MashkaPeriod = 30; break; // m1
case 5: MashkaPeriod = 12; break; // m5
case 15: MashkaPeriod = 16; break; // m15
case 30: MashkaPeriod = 16; break; // m30
case 60: MashkaPeriod = 24; break; // h1
case 240: MashkaPeriod = 12; break; // h4
case 1440: MashkaPeriod = 5; break; // daily
case 10080: MashkaPeriod = 9; break; // weekly
case 43200: MashkaPeriod = 12; break; // mountly
}*/
/* MashkaPeriod = per1;
//+------------------------------------------------------------------+
//| Simple Complex Moving Average |
//+------------------------------------------------------------------+
////////////////////////////////////////////////////////////
for(int i=0; i<limit; i++)
{
if (Symbol() == "EURUSD"){
OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);
HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);
LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("EURUSD",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "EURGBP"){
OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-GBP(Mode,PRICE_OPEN,i,per1,per2);
HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-GBP(Mode,PRICE_HIGH,i,per1,per2);
LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-GBP(Mode,PRICE_LOW,i,per1,per2);
CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-GBP(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("EURGBP",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "EURCHF"){
OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-CHF(Mode,PRICE_OPEN,i,per1,per2);
HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-CHF(Mode,PRICE_HIGH,i,per1,per2);
LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-CHF(Mode,PRICE_LOW,i,per1,per2);
CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-CHF(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("EURCHF",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "EURJPY"){
OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("EURJPY",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "GBPUSD"){
OPEN=GBP(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);
HIGH=GBP(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);
LOW=GBP(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
CLOSE=GBP(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("GBPUSD",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "GBPCHF"){
OPEN=GBP(Mode,PRICE_OPEN,i,per1,per2)-CHF(Mode,PRICE_OPEN,i,per1,per2);
HIGH=GBP(Mode,PRICE_HIGH,i,per1,per2)-CHF(Mode,PRICE_HIGH,i,per1,per2);
LOW=GBP(Mode,PRICE_LOW,i,per1,per2)-CHF(Mode,PRICE_LOW,i,per1,per2);
CLOSE=GBP(Mode,PRICE_CLOSE,i,per1,per2)-CHF(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("GBPCHF",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "GBPJPY"){
OPEN=GBP(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
HIGH=GBP(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
LOW=GBP(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
CLOSE=GBP(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("GBPJPY",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "USDCHF"){
OPEN=USD(Mode,PRICE_OPEN,i,per1,per2)-CHF(Mode,PRICE_OPEN,i,per1,per2);
HIGH=USD(Mode,PRICE_HIGH,i,per1,per2)-CHF(Mode,PRICE_HIGH,i,per1,per2);
LOW=USD(Mode,PRICE_LOW,i,per1,per2)-CHF(Mode,PRICE_LOW,i,per1,per2);
CLOSE=USD(Mode,PRICE_CLOSE,i,per1,per2)-CHF(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("USDCHF",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "USDJPY"){
OPEN=USD(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
HIGH=USD(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
LOW=USD(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
CLOSE=USD(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("USDJPY",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "CHFJPY"){
OPEN=CHF(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
HIGH=CHF(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
LOW=CHF(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
CLOSE=CHF(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("CHFJPY",0,MashkaPeriod,0,Mode,Price,i);
}
if (Symbol() == "NZDUSD"){
OPEN=NZD(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);
HIGH=NZD(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);
LOW=NZD(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
CLOSE=NZD(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
BAZZA = iMA("NZDUSD",0,MashkaPeriod,0,Mode,Price,i);
}
ComplexMashka[i]=High[i];//BAZZA + BAZZA*(OPEN+HIGH+LOW+CLOSE)/4;
//----
return(0);
}
}
///////////////////////////////////////////////////////
double USD(int Mode, int Price, int i, int per1, int per2)
{
return(
(iMA("EURUSD",0,per1,0,Mode,Price,i)-
iMA("EURUSD",0,per2,0,Mode,Price,i))/iMA("EURUSD",0,per1,0,Mode,Price,i)
+
(iMA("GBPUSD",0,per1,0,Mode,Price,i)-
iMA("GBPUSD",0,per2,0,Mode,Price,i))/iMA("GBPUSD",0,per1,0,Mode,Price,i)
+
(iMA("NZDUSD",0,per1,0,Mode,Price,i)-
iMA("NZDUSD",0,per2,0,Mode,Price,i))/iMA("NZDUSD",0,per1,0,Mode,Price,i)
+
(iMA("USDCHF",0,per2,0,Mode,Price,i)-
iMA("USDCHF",0,per1,0,Mode,Price,i))/iMA("USDCHF",0,per1,0,Mode,Price,i)
+
(iMA("USDJPY",0,per2,0,Mode,Price,i)-
iMA("USDJPY",0,per1,0,Mode,Price,i))/iMA("USDJPY",0,per1,0,Mode,Price,i)
);
}
double NZD(int Mode, int Price, int i, int per1, int per2){
return(
(iMA("NZDUSD",0,per2,0,Mode,Price,i)-
iMA("NZDUSD",0,per1,0,Mode,Price,i))/iMA("NZDUSD",0,per1,0,Mode,Price,i)
+
(iMA("GBPNZD",0,per2,0,Mode,Price,i)-
iMA("GBPNZD",0,per1,0,Mode,Price,i))/iMA("GBPNZD",0,per1,0,Mode,Price,i)
+
(iMA("NZDCHF",0,per1,0,Mode,Price,i)-
iMA("NZDCHF",0,per2,0,Mode,Price,i))/iMA("NZDCHF",0,per1,0,Mode,Price,i)
+
(iMA("EURNZD",0,per1,0,Mode,Price,i)-
iMA("EURNZD",0,per2,0,Mode,Price,i))/iMA("EURNZD",0,per1,0,Mode,Price,i)
+
(iMA("NZDJPY",0,per2,0,Mode,Price,i)-
iMA("NZDJPY",0,per1,0,Mode,Price,i))/iMA("NZDJPY",0,per1,0,Mode,Price,i)
);
}
double EUR(int Mode, int Price, int i, int per1, int per2){
return(
(iMA("EURUSD",0,per2,0,Mode,Price,i)-
iMA("EURUSD",0,per1,0,Mode,Price,i))/iMA("EURUSD",0,per1,0,Mode,Price,i)
+
(iMA("EURGBP",0,per2,0,Mode,Price,i)-
iMA("EURGBP",0,per1,0,Mode,Price,i))/iMA("EURGBP",0,per1,0,Mode,Price,i)
+
(iMA("EURCHF",0,per2,0,Mode,Price,i)-
iMA("EURCHF",0,per1,0,Mode,Price,i))/iMA("EURCHF",0,per1,0,Mode,Price,i)
+
(iMA("EURNZD",0,per2,0,Mode,Price,i)-
iMA("EURNZD",0,per1,0,Mode,Price,i))/iMA("EURNZD",0,per1,0,Mode,Price,i)
+
(iMA("EURJPY",0,per2,0,Mode,Price,i)-
iMA("EURJPY",0,per1,0,Mode,Price,i))/iMA("EURJPY",0,per1,0,Mode,Price,i)
);
}
double GBP(int Mode, int Price, int i, int per1, int per2){
return(
(iMA("GBPUSD",0,per2,0,Mode,Price,i)-
iMA("GBPUSD",0,per1,0,Mode,Price,i))/iMA("GBPUSD",0,per1,0,Mode,Price,i)
+
(iMA("EURGBP",0,per1,0,Mode,Price,i)-
iMA("EURGBP",0,per2,0,Mode,Price,i))/iMA("EURGBP",0,per1,0,Mode,Price,i)
+
(iMA("GBPCHF",0,per2,0,Mode,Price,i)-
iMA("GBPCHF",0,per1,0,Mode,Price,i))/iMA("GBPCHF",0,per1,0,Mode,Price,i)
+
(iMA("GBPNZD",0,per2,0,Mode,Price,i)-
iMA("GBPNZD",0,per1,0,Mode,Price,i))/iMA("GBPNZD",0,per1,0,Mode,Price,i)
+
(iMA("GBPJPY",0,per2,0,Mode,Price,i)-
iMA("GBPJPY",0,per1,0,Mode,Price,i))/iMA("GBPJPY",0,per1,0,Mode,Price,i)
);
}
double CHF(int Mode, int Price, int i, int per1, int per2){
return(
(iMA("USDCHF",0,per1,0,Mode,Price,i)-
iMA("USDCHF",0,per2,0,Mode,Price,i))/iMA("USDCHF",0,per1,0,Mode,Price,i)
+
(iMA("EURCHF",0,per1,0,Mode,Price,i)-
iMA("EURCHF",0,per2,0,Mode,Price,i))/iMA("EURCHF",0,per1,0,Mode,Price,i)
+
(iMA("GBPCHF",0,per1,0,Mode,Price,i)-
iMA("GBPCHF",0,per2,0,Mode,Price,i))/iMA("GBPCHF",0,per1,0,Mode,Price,i)
+
(iMA("NZDCHF",0,per1,0,Mode,Price,i)-
iMA("NZDCHF",0,per2,0,Mode,Price,i))/iMA("NZDCHF",0,per1,0,Mode,Price,i)
+
(iMA("CHFJPY",0,per2,0,Mode,Price,i)-
iMA("CHFJPY",0,per1,0,Mode,Price,i))/iMA("CHFJPY",0,per1,0,Mode,Price,i)
);
}
double JPY(int Mode, int Price, int i, int per1, int per2){
return(
(iMA("USDJPY",0,per1,0,Mode,Price,i)-
iMA("USDJPY",0,per2,0,Mode,Price,i))/iMA("USDJPY",0,per1,0,Mode,Price,i)
+
(iMA("EURJPY",0,per1,0,Mode,Price,i)-
iMA("EURJPY",0,per2,0,Mode,Price,i))/iMA("EURJPY",0,per1,0,Mode,Price,i)
+
(iMA("GBPJPY",0,per1,0,Mode,Price,i)-
iMA("GBPJPY",0,per2,0,Mode,Price,i))/iMA("GBPJPY",0,per1,0,Mode,Price,i)
+
(iMA("NZDJPY",0,per1,0,Mode,Price,i)-
iMA("NZDJPY",0,per2,0,Mode,Price,i))/iMA("NZDJPY",0,per1,0,Mode,Price,i)
+
(iMA("CHFJPY",0,per1,0,Mode,Price,i)-
iMA("CHFJPY",0,per2,0,Mode,Price,i))/iMA("CHFJPY",0,per1,0,Mode,Price,i)
);
}
//+------------------------------------------------------------------+ */
Comments