//+------------------------------------------------------------------+
//| Index.mq4 |
//| Copyright 2017, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
#property indicator_separate_window
#property indicator_buffers 2
double buf[];
double daf[];
input int Count=200;
input string X1="EURAUD";
input string X2="EURCAD";
input string X3="EURJPY";
input string X4="EURGBP";
input string X5="EURCHF";
input string S1="EURUSD";
input string S2="GBPUSD";
input string S3="USDJPY";
input string S4="USDCAD";
input string S5="USDCHF";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---- indicators
SetIndexStyle(0,DRAW_SECTION,EMPTY,2,clrLime);
SetIndexStyle(1,DRAW_LINE,EMPTY,2,clrRed);
SetIndexBuffer(0,buf);
SetIndexBuffer(1,daf);
Comment("");
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
for(int i=0;i<Count;i++)
{
buf[i]=(iAO(X1,0,i)+iAO(X2,0,i)+iAO(X3,0,i)+iAO(X4,0,i)+iAO(X5,0,i))/5;
daf[i]=((-1)*iAO(S1,0,i)+(-1)*iAO(S2,0,i)+iAO(S3,0,i)+iAO(S4,0,i)+iAO(S5,0,i))/5;
//2 первых параметра отрицательные, так как котировки обратные
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Index++.mq4 |
//| Copyright 2017, AM2&&axe44 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, AM2&&axe44"
#property link "http://www.forexsystems.biz"
#property version "2.00"
#property strict
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
double buf[],buf1[];
input int Count=1000;
input string S1="EURUSD";
input string S2="GBPUSD";
input string S3="USDJPY";
input string S4="USDCAD";
input string S5="USDCHF";
input string X1="EURUSD";
input string X2="GBPUSD";
input string X3="USDJPY";
input string X4="USDCAD";
input string X5="USDCHF";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,EMPTY,1,clrRed);
SetIndexStyle(1,DRAW_LINE,EMPTY,1,clrLime);
SetIndexBuffer(0,buf);
SetIndexBuffer(1,buf1);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
for(int i=0;i<Count;i++)
{
buf[i]=(iBWMFI(S1,0,i)+iBWMFI(S2,0,i)+iBWMFI(S3,0,i)+iBWMFI(S4,0,i)+iBWMFI(S5,0,i))/5;
buf1[i]=(iBWMFI(X1,0,i)+iBWMFI(X2,0,i)+iBWMFI(X3,0,i)+iBWMFI(X4,0,i)+iBWMFI(X5,0,i))/5;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Как бы мне понятно, что не понятно почему себя ведёт так брокер.
axe44