Спасибо. В параметры Индикатора не включен следующее.
1. Параметры индикатора ЗигЗаг
И почему то терминал тормозит после запуска индикатора, пока не удалось запустить индикатор.
//+------------------------------------------------------------------+
//| ZZZ.mq4 |
//| Copyright 2018, AM2 |
//| http://www.forexsyatems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, AM2"
#property link "http://www.forexsyatems.biz"
#property version "1.00"
#property strict
#property indicator_chart_window
input string s1="GBPUSD";
input string s2="EURUSD";
input string s3="USDCHF";
input ENUM_TIMEFRAMES tf=PERIOD_H1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double GetExtremumZZPrice(string sy="",int tfm=0,int ne=0,int dp=12,int dv=5,int bs=3)
{
if(sy=="" || sy=="0") sy=Symbol();
double zz;
int i,k=iBars(sy,tfm),ke=0;
for(i=1; i<k; i++)
{
zz=iCustom(sy,tfm,"ZigZag",dp,dv,bs,0,i);
if(zz!=0)
{
ke++;
if(ke>ne) return(zz);
}
}
Print("GetExtremumZZPrice(): Экстремум ЗигЗага номер ",ne," не найден");
return(0);
}
//+------------------------------------------------------------------+
//| 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[])
{
//---
double zz11=GetExtremumZZPrice(s1,tf,0,12,5,3);
double zz12=GetExtremumZZPrice(s1,tf,1,12,5,3);
double p1=MarketInfo(s1,MODE_POINT);
double zz21=GetExtremumZZPrice(s2,tf,0,12,5,3);
double zz22=GetExtremumZZPrice(s2,tf,1,12,5,3);
double p2=MarketInfo(s2,MODE_POINT);
double zz31=GetExtremumZZPrice(s3,tf,0,12,5,3);
double zz32=GetExtremumZZPrice(s3,tf,1,12,5,3);
double p3=MarketInfo(s3,MODE_POINT);
double po1=(zz11-zz12)/p1;
double po2=(zz21-zz22)/p2;
double po3=(zz31-zz32)/p3;
double bid1=MarketInfo(s1,MODE_BID);
double bid2=MarketInfo(s2,MODE_BID);
double bid3=MarketInfo(s3,MODE_BID);
Comment("\n "+s1+" "+(string)((int)(po1))+" points "+(string)(NormalizeDouble(MathAbs(po1/bid1/100),2))+"%",
"\n "+s2+" "+(string)((int)(po2))+" points "+(string)(NormalizeDouble(MathAbs(po2/bid2/100),2))+"%",
"\n "+s3+" "+(string)((int)(po3))+" points "+(string)(NormalizeDouble(MathAbs(po3/bid3/100),2))+"%");
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
AM2