Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
MultiPairTrend
//+------------------------------------------------------------------+
//| MultiPairTrend.mq4 |
//+------------------------------------------------------------------+
#property copyright "Alexander Arzumanov"
#property link "arzuma@helios.ru arzuma@megalog.ru"
#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Orange
#property indicator_color4 White
#property indicator_color5 Yellow
#property indicator_color6 Aqua
#property indicator_color7 Lime
double EUR,GBP,AUD,CHF,JPY,CAD,USD,M;
extern int PerAvr=5;
extern double K=0.6;
double Idx[],Idx1[],Idx2[],Idx3[],Idx4[],Idx5[],Idx6[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(0,Idx);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(1,Idx1);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(2,Idx2);
SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(3,Idx3);
SetIndexStyle(4,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(4,Idx4);
SetIndexStyle(5,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(5,Idx5);
SetIndexStyle(6,DRAW_LINE,STYLE_SOLID,3);
SetIndexBuffer(6,Idx6);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
for(int i=limit; i>=0; i--)
{
int M=NormalizeDouble(1+K,0);
EUR=(iMA("EURUSD",0,PerAvr,0,MODE_LWMA,PRICE_CLOSE,i)-iMA("EURUSD",0,PerAvr*M,0,MODE_LWMA,PRICE_CLOSE,i));
GBP=(iMA("GBPUSD",0,PerAvr,0,MODE_LWMA,PRICE_CLOSE,i)-iMA("GBPUSD",0,PerAvr*M,0,MODE_LWMA,PRICE_CLOSE,i));
AUD=(iMA("AUDUSD",0,PerAvr,0,MODE_LWMA,PRICE_CLOSE,i)-iMA("AUDUSD",0,PerAvr*M,0,MODE_LWMA,PRICE_CLOSE,i));
CHF=(iMA("USDCHF",0,PerAvr*M,0,MODE_LWMA,PRICE_CLOSE,i)-iMA("USDCHF",0,PerAvr,0,MODE_LWMA,PRICE_CLOSE,i));
JPY=(iMA("USDJPY",0,PerAvr*M,0,MODE_LWMA,PRICE_CLOSE,i)-iMA("USDJPY",0,PerAvr,0,MODE_LWMA,PRICE_CLOSE,i))/100;
CAD=(iMA("USDCAD",0,PerAvr*M,0,MODE_LWMA,PRICE_CLOSE,i)-iMA("USDCAD",0,PerAvr,0,MODE_LWMA,PRICE_CLOSE,i));
USD=-(EUR+GBP+AUD+CHF+CAD+JPY)/6;
Idx[i] = EUR;
Idx1[i] = GBP;
Idx2[i] = AUD;
Idx3[i] = CHF;
Idx4[i] = JPY;
Idx5[i] = CAD;
Idx6[i] = USD;
}
//----
//----
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
---