MQL4 как сделать так, чтобы индикатор сканировал несколько пар и несколько таймфреймов? - PullRequest
0 голосов
/ 29 октября 2019

Это только половина кода, потому что stackoverflow не допускает код выше 30000 символов

#property stacksize 65535
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 clrMagenta //clrRed 
//#property indicator_width6 5 
#property indicator_color2 clrGreen
#property indicator_color3 clrOrange
#property indicator_color4 clrLightSkyBlue
#property indicator_color5 clrLemonChiffon
//#property indicator_color4 clrChartreuse
//#property indicator_color5 clrRed
#property indicator_color6 clrMagenta //clrYellow

#property version "2.148"
#property description "ZigZag óíèâåðñàëüíûé ñ ïàòòåðíàìè Ïåñàâåíòî"
#property description " "
#property description "Âåðñèÿ äëÿ ïîèñêà ïàòòåðíîâ"

#define pi  3.14159265
#define phi 1.6180339887

//===================================

// Ïàòòåðíû Gartley
extern string ______________3_____________ = "Parameters for Gartley Patterns";
extern int    AlgorithmSearchPatterns = 0;
extern int    PotencialsLevels_retXD  = 1;
extern int    visibleLevelsABCD       = 3;
// Ïàðàìåòðû äëÿ çèãçàãà èç MT4  è çèãçàãà Talex
extern int    maxDepth                = 5;
extern int    minDepth                = 3;
extern bool   FiboStep                = true; //false;
extern int    IterationStepDepth      = 2;
// Ïàðàìåòðû äëÿ çèãçàãà Àëåêñà 1 è çèãçàãà Ensign - ìåíÿåì ðàçìåð
extern int    maxSize_                = 150;
extern int    minSize_                = 15;
extern int    IterationStepSize       = 3;
// Ïàðàìåòðû äëÿ çèãçàãà Àëåêñà 2 - ìåíÿåì ïðîöåíò
extern double maxPercent_             = 10.0;
extern double minPercent_             = 0.4;
extern double IterationStepPercent    = 15;
//
extern bool   DirectionOfSearchMaxMin = true;
extern int    SelectPattern           = 0;
extern string visiblePattern          = "000000000000000000000000000000000";
extern int    NumberPattern           = 1;  // Íîìåð ïàòòåðíà, ïî êîòîðîìó êàëèáðóåòñÿ çèãçàã è ïàðàìåòðû êîòîðîãî âûâîäÿòñÿ ÷åðåç InfoTF
extern int    ExtGartleyTypeSearch    = 0;
extern int    ExtHiddenPP             = 1;
extern bool   ExtGartleyOnOff         = true;
//extern int    VarDisplay=0;
extern int    maxBarToD               = 15;
extern int    patternInfluence        = 1; //2;
extern bool   patternTrue             = true;
extern double AllowedBandPatternInfluence = 1.618;
extern bool   RangeForPointD          = true;
extern bool   OldNewRangeForPointD    = false;
extern color  ExtColorRangeForPointD  = clrBlue;
extern int    VectorOfAMirrorTrend    = 0;
extern color  VectorOfAMirrorTrendColor  = clrLawnGreen;
extern int    VectorOfAMirrorTrendStyle  = STYLE_DASH;
extern bool   shortNamePatterns       = false;
extern bool   visibleLineOrTriangle   = true;
extern int    PatternLineStyle        = 0;
extern int    PatternLineWidth        = 3;
extern color  ExtColorPatterns        = clrDodgerBlue;
extern string ExtColorPatternList     = "clrBlue,clrDarkGreen,clrFireBrick,clrDeepPink,clrRoyalBlue,clrSienna,clrDodgerBlue,clrCornflowerBlue,clrTomato,clrSlateBlue,clrMediumSlateBlue,clrSlateGray,clrBlueViolet";
//extern string ExtColorPatternList     = "clrBlue,clrDarkGreen,clrNavy,clrSienna,clrMediumBlue,clrRoyalBlue,clrDodgerBlue,clrCornflowerBlue,clrLightSkyBlue,clrSlateBlue,clrMediumSlateBlue,clrSlateGray,clrLightSteelBlue";
extern double ExtDeltaGartley         = 0.09;
extern double ExtDeltaGartleyPRZ      = 0.02;

extern int    levelD                  = 0;
extern color  colorLevelD             = clrRed;

//---------------
extern bool   Equilibrium             = false;
extern bool   ReactionType            = false;
extern int    EquilibriumStyle        = 1;
extern int    EquilibriumWidth        = 0;
extern color  ColorEquilibrium        = clrRed;
extern color  ColorReaction           = clrTomato;
//--------------- 3 Drives ----------
extern bool   Ext_3Drives             = true;
extern double Ext_xO                  = 1.618;
//--------------- Dragon ------------
extern bool   Dragon                  = true;
extern int    PeakZZDragon            = 7;
//--------------- 4-Point Pattern ---
extern bool   Ext_4PointPattern       = true;
extern double _maxXB                  = 0.618;
//--------------- AB=CD -------------
extern int    ABCD                    = 2; 
extern bool   searchABCDAlternate     = false;
extern string ABCDAlternate           = "0.618,0.786,0.886,1.128,1.272,1.618,2.618";
extern bool   visibleABCDrayZZ        = true;
//---------------
extern bool   Ext_noname              = false;
//---------------
extern int    CustomPattern           = 0; // 0 - íå âûâîäèòñÿ ïîëüçîâàòåëüñêèé ïàòòåðí 
                                           // 1 - âûâîäèòñÿ âìåñòå ñ îñíîâíîé ãðóïïîé ïàòòåðíîâ
                                           // 2 - âûâîäèòñÿ òîëüêî custom ïàòòåðí
extern string NameCustomPattern       = "Custom";
extern double minXB                   = 0.67; // 0.382;  //0.5;
extern double maxXB                   = 0.67; // 0.942;  //0.618;
extern double minAC                   = 0.618; // 0.447;  //0.382;
extern double maxAC                   = 0.618; // 0.942;  //0.618;
extern double minBD                   = 2.46; // 1.144;  //1.128;
extern double maxBD                   = 2.46; // 2.128;  //1.272;
extern double minXD                   = 1.272; // 0.5;    //0.618;
extern double maxXD                   = 1.272; // 0.942;  //0.886;

extern bool   filtrEquilibrium           = true;

// Âûâîä â ôàéëû èíôîðìàöèè î ïàòòåðíàõ. ×òåíèå èç ôàéëà ñïèñêà ïàòòåðíîâ
extern int    readFromFileListPatterns   = 1;
extern string NameFileListPatterns       = "SN";
extern bool   writeToFileListPatterns    = false;
extern bool   picture                    = false;
extern int    writeInfoPatternsToFileXML = 0;
extern int    writeInfoPatternsToFileCSV = 0;
extern bool   namefileSymbolPeriod       = false;

extern bool   InfoPointD                 = false;

extern bool   MonitorPatterns            = true;
extern int    TextSize                   = 10;

extern bool   ExtGlobalVariableSet       = false;
//---- indicator parameters
extern string ______________0_____________ = "Parameters for ZigZag";
extern int    ExtIndicator            = 11; 
extern int    ParametresZZforDMLEWA   = 6;
extern int    minBars                 = 8;
extern int    minSize                 = 50;
// Ïåðåìåííûå îò ZigZag èç ÌÒ
extern int    ExtDeviation            = 5;
extern int    ExtBackstep             = 3;
extern bool   noBackstep              = false;
extern bool   RecoverFiltr            = false;
// Ïåðåìåííàÿ äëÿ nen-ZigZag
extern int    GrossPeriod             = 240;
//----
extern double minPercent              = 0.0;      // 0.08
extern int    ExtPoint=11; // êîëè÷åñòâî òî÷åê çèãçàãà äëÿ çèãçàãà Talex 
// Ïàðàìåòðû äëÿ çèãçàãà, ðàçðàáîòàííîãî wellx
extern int    StLevel                 = 28;
extern int    BigLevel                = 32; 
extern bool   auto                    = true;
extern double minBar=38.2, maxBar=61.8;

extern bool   ExtStyleZZ              = true;

extern int    ExtMaxBar               = 1400;     // Êîëè÷åñòâî áàðîâ îáñ÷¸òà (0-âñå)
extern int    ExtMinBar               = 0;
// âûâîä íîìåðîâ ïåðåëîìîâ çèãçàãîâ
extern bool   ExtNumberPeak           = false;
extern bool   ExtNumberPeak10         = true;
extern bool   ExtNumberPeakLow        = true;
extern color  ExtNumberPeakColor      = clrRed;
extern int    ExtNumberPeakFontSize   = 11;

extern string ______________1_____________ = "Parameters for fibo Levels";
extern bool   ExtFiboDinamic          = false;
extern bool   ExtFiboStatic           = false;
extern int    ExtFiboStaticNum        = 2;
extern bool   ExtFiboCorrectionExpansion = false;
extern color  ExtFiboD                = clrSienna;
extern color  ExtFiboS                = clrTeal;
extern int    ExtFiboStyle            = 2;
extern int    ExtFiboWidth            = 0;
//-------------------------------------

extern string ______________2_____________ = "Parameters for Pesavento Patterns";
extern int    ExtPPWithBars           = 0;
extern int    ExtHidden               = 1;
extern int    ExtFractal              = 7;
extern int    ExtFractalEnd           = 7;
extern int    ExtFiboChoice           = 2;
extern bool   ExtFiboZigZag           = false;
extern double ExtDelta                = 0.04;
extern int    ExtDeltaType            = 2;
extern int    ExtSizeTxt              = 9;
extern color  ExtLine                 = clrDarkBlue;
extern color  ExtLine886              = clrPurple;
extern color  ExtNotFibo              = clrBlack;
extern color  ExtPesavento            = clrBlue; // Yellow; Öâåòà äëÿ áåëîãî ôîíà. Óáðàë öâåòà äëÿ ÷åðíîãî ôîíà 
extern color  ExtGartley886           = clrRed; // GreenYellow;
       color  colorPPattern;

extern string ______________4_____________ = "Parameters Exp";
extern bool   chHL                = false;
extern bool   PeakDet             = false;
extern bool   chHL_PeakDet        = true;
extern int    ExtLabel            = 0;
extern int    ExtCodLabel         = 116;

extern string ______________5_____________ = "Common Parameters";
//--------------------------------------
extern int    ExtFiboType       = 1;
extern string ExtFiboTypeFree  = "0,0.382,0.618,0.764,1,1.236,1.618"; // ïîëüçîâàòåëüñêèå óðîâíè ôèáî 
extern color  ExtObjectColor    = clrNONE;
extern int    ExtObjectStyle    = 1;
extern int    ExtObjectWidth    = 0; 
// âûâîä ñòàòè÷åñêèõ îáúåêòîâ â ðåæèìå äèíàìè÷åñêèõ
extern bool   ExtDinamic        = false; //true; //
extern string ExtVisibleDinamic = "01";
extern bool   RefreshStaticNewRayZZ =true;

extern bool   ZigZagHighLow     = true;

extern bool   ExtSendMail       = false;
extern bool   ExtAlert          = false;
extern bool   ExtPlayAlert      = false;
extern string AlertText         = "ïîÿâèëñÿ íîâûé Ïàòòåðí";

extern bool   ExtBack           = true;

extern bool   ExtSave           = false;
extern string info_comment      = "0011";
extern bool   infoMerrillPattern= false;
extern bool   infoTF            = true;
extern bool   bigText           = true;
extern int    bigTextSize       = 16;
extern color  bigTextColor      = clrBlue;
extern color  bigTextColorBearish = clrBlue;
extern int    bigTextX          = 50;
extern int    bigTextY          = 20;
extern bool   ExtVisible        = true;
extern int    ExtComplekt       = 3;

double zz[];

double zzL[];

double zzH[];

double nen_ZigZag[];

int    _maxbarZZ; // êîëè÷åñòâî áàðîâ, ó÷àñòâóþùèõ â ðàñ÷åòå çèãçàãîâ.

// ïåðåìåííûå äëÿ õðàíåíèÿ ïàðàìåòðîâ ñòàíäàðòíîãî çèãçàãà
int _ExtBackstep, _minBars, _minSize;

// Ìàññèâ ÷èñåë, çàäàííûõ ïîëüçîâàòåëåì
double fi[];
string fitxt[];
string fitxt100[];
int    Sizefi=0,Sizefi_1=0;

color  ExtLine_;

double number[64];
string numbertxt[64];
int    numberFibo[64];
int    numberPesavento[64];
int    numberGartley[64];
int    numberMix[64];
int    numberGilmorQuality[64];
int    numberGilmorGeometric[64];
int    numberGilmorHarmonic[64];
int    numberGilmorArithmetic[64];
int    numberGilmorGoldenMean[64];
int    numberSquare[64];
int    numberCube[64];
int    numberRectangle[64];
int    numberExt[64];

string nameObj="", nameObjtxt="", save="";
// 
bool descript_b=false;
// PPWithBars - òåêñò, âûâîäèìûé ó ñîåäèíèòåëüíîé ëèíèè
// descript - îïèñàíèå îáúåêòîâ
string PPWithBars="", descript="";
// Ìàòðèöà äëÿ ïîèñêà èñ÷åçíóâøèõ áàðîâ afr - ìàññèâ çíà÷åíèé âðåìåíè ïÿòè ïîñëåäíèõ ôðàêòàëîâ è îòðèñîâêè äèíàìè÷åñêèõ è ñòàòè÷åñêèõ ôèá
// afrl - ìèíèìóìû, afrh - ìàêñèìóìû
int afr[]={0,0,0,0,0,0,0,0,0,0};
double afrl[]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}, afrh[]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}, afrx[]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
// Ïàðàìåòðû òàéìôðéìîâ
double openTF[]={0.0,0.0,0.0,0.0,0.0}, closeTF[]={0.0,0.0,0.0,0.0,0.0}, lowTF[]={0.0,0.0,0.0,0.0,0.0}, highTF[]={0.0,0.0,0.0,0.0,0.0};
string TF[]={"MN","W1","D1","H4","H1","m30","m15","m5","m1"};
string Period_tf="";
bool   afrm=true;
double ExtHL;
double HL,HLp,kk,kj,Angle;
// LowPrim,HighPrim,LowLast,HighLast - çíà÷åíèÿ ìèíèìóìîâ è ìàêñèìóìîâ áàðîâ
double LowPrim,HighPrim,LowLast,HighLast;
// numLowPrim,numHighPrim,numLowLast,numHighLast -íîìåðà áàðîâ
int numLowPrim,numHighPrim,numLowLast,numHighLast,k1,k2,countLow1,countHigh1,shift1,shift2,shift3;
string txtkk="", txtRet="";
// Âðåìÿ áàðà ñ ïåðâûì, âòîðûì è òðåòüèì îò íóëåâîãî áàðà ôðàêòàëîì
int timeFr1new,timeFr2new,timeFr3new;
// Ñ÷åò÷èê ôðàêòàëîâ
int countFr;
// Áàð, äî êîòîðîãî íàäî ðèñîâàòü ñîåäèíèòåëüíûå ëèíèè îò íóëåâîãî áàðà
int countBarEnd=0,TimeBarEnd;
// Áàð, äî êîòîðîãî íàäî ïåðåñ÷èòûâàòü îò íóëåâîãî áàðà
int numBar=0;
// Íîìåð îáúåêòà
int numOb;
// flagFrNew=true - îáðàçîâàëñÿ íîâûé ôðàêòàë èëè ïåðâûé ôðàêòàë ñìåñòèëñÿ íà äðóãîé áàð. =false - ïî óìîë÷àíèþ.
bool flagFrNew=false;
// èäåíòèôèêàòîð íîâîãî ëó÷à
bool newRay=true;
// flagGartley - ïîÿâëåíèå íîâîãî ïàòòåðíà Gartley èëè èñ÷åçíîâåíèå ïàòòåðíà Gartley
bool flagGartley=false;
// Ïåðèîä òåêóùåãî ãðàôèêà
int perTF;
bool Demo;
// Ïåðåìåííûå äëÿ çèãçàãà, ðàçðàáîòàííîãî wellx
bool   first=true;
int    NewBarTime=0, countbars=0;
int    realcnt=0;

double int_to_d=0, int_to_d1=0, int_to_d2=0;

int counted_bars, cbi, iBar;

// Ïåðåìåííûå äëÿ ZigZag Àëåêñà è èíäèêàòîðà ïîäîáíîãî âñòðîåííîìó â Ensign
double ha[],la[],hi,li,si,sip,di,hm,lm,ham[],lam[],him,lim,lLast=0,hLast=0;
int fs=0,fsp,countBar;
int ai,bi,ai0,bi0,aim,bim;
datetime tai,tbi,ti,tmh,tml;
// fcount0 - ïðè îáíóëåíèè ñ÷åò÷èêà ïðîïóùåííûõ áàðîâ íà 0 áàðå fcount0=true.
// Íà ñëåäóþùåì áàðå =false è ìîæíî îïðåäåëÿòü òî÷êó ïåðåëîìà
bool fh=false,fl=false,fcount0,PeakDetIni;

/*
// Ïåðåìåííûå äëÿ Ñâèíãîâ Ãàííà
double lLast_m=0, hLast_m=0;
int countBarExt; // ñ÷åò÷èê âíåøíèõ áàðîâ
int countBarl,countBarh;
*/
// Ïåðåìåííûå äëÿ nen-ZigZag
bool hi_nen;
bool init_zz=true;

// Ïåðåìåííûå äëÿ ðàñøèðåííîãî ðåæèìà ðàáîòû èíäèêàòîðà
int mFibo[]={0,0};

double   hBar, lBar;
datetime tiZZ;

// Ïåðåìåííûå äëÿ ïàòòåðíîâ Gartley
string   vBullBear    = ""; // ïåðåìåííàÿ äëÿ îáîçíà÷åíèÿ áû÷èé èëè ìåäâåæèé ïàòòåðí
string   vNamePattern = ""; // ïåðåìåííàÿ äëÿ îáîçíà÷åíèÿ íàèìåíîâàíèÿ ïàòòåðíà
string   vBullBearToNumberPattern    = "";
string   vNamePatternToNumberPattern = "";
string   _InfoPointD                 = "";
bool     vPatOnOff = false, vPatNew = false, saveParametersZZ=false;
bool     vWriteToFilePattern = false, vpicture=false;

datetime TimeForDmin  = 0, TimeForDminToNumberPattern;
datetime TimeForDmax  = 0, TimeForDmaxToNumberPattern;
double   LevelForDmin = 0, LevelForDminToNumberPattern;
double   LevelForDmax = 0, LevelForDmaxToNumberPattern;
double   save_cenaPointD;
datetime save_timePointD_0;
double   PeakCenaX[1],PeakCenaA[1],PeakCenaB[1],PeakCenaC[1],PeakCenaD[1];
datetime PeakTimeX[1],PeakTimeA[1],PeakTimeB[1],PeakTimeC[1],PeakTimeD[1];
string   __NamePatterns[1][2];
int      __D[1][4];
color    __PatColor[1];
int      countGartley = 0;      // Ñ÷åò÷èê ïàòòåðíîâ
int      minBarsToNumberPattern;
int      minSizeToNumberPattern;
int      vBackstepToNumberPattern;
double   minPercentToNumberPattern;
color    ColorList[];
int      ColorSize;
int      countColor   = 0;
bool     flagExtGartleyTypeSearch2=false; // ñèãíàë âûêëþ÷åíèÿ ïîèñêà ïàòòåðíîâ â ðåæèìå êèòàéñêàÿ èãðóøêà
int      minBarsSave, minBarsX;

bool     CustomPat_[33];

//string   namepatterns[];
string namepatterns[33]=
{"Gartley","Bat","Alternate Bat","Butterfly","Crab","Deep Crab","Leonardo","Shark","Cypher","Nen STAR","5-0",
"A Gartley","A Bat","A Alternate Bat","A Butterfly","A Crab","A Deep Crab","A Leonardo","A Shark","A Cypher","A Nen STAR","A 5-0",
"Black Swan","White Swan","Navarro 200","max Bat","max Gartley","max Butterfly","TOTAL 1","TOTAL 2","TOTAL 3","TOTAL 4","TOTAL"};

int countPat;
int typepatterns[33];
//  0    1     2     3     4     5     6     7     8      9      10     11     12     13     14      15
//minXB,maxXB,minAC,maxAC,minBD,maxBD,minXD,maxXD,minXXA,maxXXA,minXCD,maxXCD,minXAB,maxXDC,TimeXXB,lineXB
//double pp[,16];                                                   // priznakipatterns=pp

double pp[33][16]=                                                 // priznakipatterns=pp
{0.618,0.618,0.382,0.886,1.128,1.618,0.786,0.786,0,0,0,0,0,0,0,1,
0.382,0.5,0.382,0.886,1.618,2.618,0.886,0.886,0,0,0,0,1.272,0,0,1,
0.382,0.382,0.382,0.886,2.0,4.236,1.128,1.128,0,0,0,0,1.618,0,0,1,
0.786,0.786,0.382,0.886,1.618,2.618,1.272,1.618,0,0,0,0,1.272,0,0,1,
0.382,0.618,0.382,0.886,2.236,4.236,1.618,1.618,0,0,0,0,0,0,0,1,
0.886,0.886,0.382,0.886,2.618,4.236,1.618,1.618,0,0,0,0,0,0,0,1,
0.5,0.5,0.382,0.886,1.128,2.618,0.786,0.786,0,0,0,0,0,0,0,1,
0,0,1.128,1.618,1.618,2.236,0.886,1.128,0,0,0,0,0,0,0,1,
0.382,0.618,0,0,0,0,0.786,0.786,1.272,1.414,0,0,0,0,0,1,
0.382,0.618,0,0,0,0,1.272,1.272,1.272,1.414,0,0,0,0,0,1,
1.128,1.618,1.618,2.236,0.5,0.5,0,0,0,0,0,0,0,0,0,0, //5-0
0.618,0.886,1.128,2.618,1.618,1.618,1.272,1.272,0,0,0,0,0,0,0,1,
0.382,0.618,1.128,2.618,2.0,2.618,1.128,1.128,0,0,0,0,0,0.786,0,1,
0.236,0.5,1.128,2.618,2.618,2.618,0.886,0.886,0,0,0,0,0,0.618,0,1,
0.382,0.618,1.128,2.618,1.272,1.272,0.618,0.786,0,0,0,0,0,0.786,0,1,
0.236,0.447,1.128,2.618,1.128,2.618,0.618,0.618,0,0,0,0,0,0,0,1,
0.236,0.382,1.128,2.618,1.128,1.128,0.618,0.618,0,0,0,0,0,0,0,1,
0.382,0.886,1.128,2.618,2.0,2.0,1.272,1.272,0,0,0,0,0,0,0,1,
0.447,0.618,0.618,0.886,0,0,0.886,1.128,0,0,0,0,0,0,0,1,
0,0,0,0,1.618,2.618,1.272,1.272,0,0,1.272,1.414,0,0,0,0,
0,0,0,0,1.618,2.618,0.786,0.786,0,0,1.272,1.414,0,0,0,1,
2.0,2.0,0.447,0.618,0.618,0.886,0,0,0,0,0,0,0,0,0,0,
1.382,2.618,0.236,0.5,1.128,2.0,1.128,2.618,0,0,0,0,0,0,0,1,
0.382,0.724,2.0,4.236,0.5,0.886,0.382,0.886,0,0,0,0,0,0,0,1,
0.786,0.786,0.886,1.128,0,0,0.886,1.128,0,0,0,0,0,0,1,0,
0.382,0.618,0.382,0.886,1.272,2.618,0.886,0.886,0,0,0,0,1.272,0,0,1,
0.382,0.618,0.382,0.886,1.128,2.236,0.618,0.786,0,0,0,0,0,0,0,1,
0.618,0.886,0.382,0.886,1.272,2.618,1.272,1.618,0,0,0,0,1.272,0,0,1,
0.382,0.786,0.382,0.886,1.272,2.618,0.786,0.886,0,0,0,0,0,0,0,1,
0.382,0.786,0.382,0.886,1.618,4.236,1.128,1.618,0,0,0,0,0,0,0,1,
0.236,0.618,1.128,2.618,1.272,2.618,0.618,0.886,0,0,0,0,0,0,0,1,
0.382,0.786,1.128,2.618,1.618,2.618,1.128,1.272,0,0,0,0,0,0,0,1,
0.236,0.786,0.382,2.618,1.272,4.236,0.618,1.618,0,0,0,0,0,0,0,1};

int retresmentXD[][2], retresmentBD[][2], arrXD_BD[2];

double minXB_[33], maxXB_[33], minAC_[33], maxAC_[33], minBD_[33], maxBD_[33], minXD_[33], maxXD_[33], minXXA_[33], maxXXA_[33], minXCD_[33], maxXCD_[33], minXAB_[33], maxXDC_[33];

int      levelXD[32,2];   // íîìåð ïàòòåðíà, êîä óðîâíÿ
double   level_D[32];     // çíà÷åíèå öåíû ïîòåíöèàëüíîãî óðîâíÿ òî÷êè D ïàòòåðíà
string   level_nameD[32]; // íàèìåíîâàíèå ïîòåíöèàëüíîãî óðîâíÿ òî÷êè D ïàòòåðíà

double   deltapatterns[3][20][2];
//                          0      1     2     3    4   5      6     7    8    9    10   11    12     13   14   15    16    17    18    19
double   retpatterns[20]={0.146,0.236,0.382,0.447,0.5,0.618,0.707,0.786,0.886,1.0,1.128,1.272,1.414,1.618,2.0,2.236,2.618,3.1416,3.618,4.236};
string   retpatternstxt[20]={".146",".236",".382",".447",".5",".618",".707",".786",".886","1.0","1.128","1.272","1.414","1.618","2.0","2.236","2.618","3.14","3.618","4.236"};
double   min_DeltaGartley, max_DeltaGartley;
int      ret[5][2]; // XD-XB-AC-BD, âî âòîðîì èçìåðåíèè äëÿ ExtDeltaGartley - 2, äëÿ ExtDelta - 1, äëÿ ExtDeltaGartleyPRZ - 0

double   _ABCDtype[];
string   _ABCDtypetxt[];
int      _ABCDsize;

int f=1; // äëÿ alerta

// Ïåðåìåííûå äëÿ Merrill Patterns
double   mPeak0[5][2]={0,5,0,4,0,3,0,2,0,1}, mPeak1[5][2]={0,5,0,4,0,3,0,2,0,1};
string   mMerrillPatterns[32][3]=
{"21435", "M1", "DownTrend",
"21453", "M2", "InvertedHeadAndShoulders",
"24135", "M3", "DownTrend",
"24153", "M4", "InvertedHeadAndShoulders",
"42135", "M5", "Broadening",
"42153", "M6", "InvertedHeadAndShoulders",
"24315", "M7", "*",
"24513", "M8", "InvertedHeadAndShoulders",
"42315", "M9", "*",
"42513", "M10", "InvertedHeadAndShoulders",
"45213", "M11", "InvertedHeadAndShoulders",
"24351", "M12", "*",
"24531", "M13", "Triangle",
"42351", "M14", "*",
"42531", "M15", "UpTrend",
"45231", "M16", "UpTrend",
"13245", "W1", "DownTrend",
"13524", "W2", "DownTrend",
"15324", "W3", "*",
"13224", "W4", "Triangle",
"15342", "W5", "*",
"31254", "W6", "HeadAndShoulders",
"42513", "W7", "HeadAndShoulders",
"51324", "W8", "*",
"31542", "W9", "HeadAndShoulders",
"51324", "W10", "*",
"35124", "W11", "HeadAndShoulders",
"53124", "W12", "Broadening",
"35142", "W13", "HeadAndShoulders",
"53142", "W14", "UpTrend",
"35412", "W15", "HeadAndShoulders",
"53412", "W16", "UpTrend"};

// Ïåðåìåííûå äëÿ çèãçàãà Talex
static int    endbar = 0;
static double endpr  = 0;
// Ïåðåìåííûå äëÿ ïîñòðîåíèÿ âèë Ýíäðþñà îò ïðîèçâîëüíûõ ñâå÷åé
bool   tik1 = true;

//+------------------------------------------------------------------+
//| Custom indicator initialization function. Íà÷àëî.                |
//+------------------------------------------------------------------+
int init()
  {
   if (!ExtVisible) return(-1);

   string aa="", aa1="", txt="";
   int i, j, k, m;
   int bb=0,bb1=-1;

   if (ParametresZZforDMLEWA>0 && (ExtIndicator==0 || ExtIndicator==6 || (NumberPattern==0 && ExtIndicator==11)))
     {
      switch (ParametresZZforDMLEWA)
        {
         case 1:
           _minBars=5; _ExtBackstep=8;
           break;
         case 2:
           _minBars=8; _ExtBackstep=13;
           break;
         case 3:
           _minBars=13; _ExtBackstep=21;
           break;
         case 4:
           _minBars=21; _ExtBackstep=34;
           break;
         case 5:
           _minBars=34; _ExtBackstep=55;
           break;
         case 6:
           _minBars=55; _ExtBackstep=89;
           break;
         case 7:
           _minBars=89; _ExtBackstep=144;
           break;
         case 8:
           _minBars=144; _ExtBackstep=233;
        }
     }
   else
     {
      _minBars=minBars; _ExtBackstep=ExtBackstep;
     }
   minBarsToNumberPattern=_minBars; vBackstepToNumberPattern=_ExtBackstep;
   minBarsSave=minBars;

   IndicatorBuffers(8);

   if (ExtIndicator==14)
     {
      if (auto)
        {
         double wrmassiv[];

         if (minBar>=100) minBar=61.8;
         if (minBar<=0)   minBar=61.8;
         if (maxBar>=100) maxBar=38.2;
         if (minBar<=0)   minBar=38.2;

         ArrayResize(wrmassiv,Bars-1);
         for (i=Bars-1;i>0;i--) {wrmassiv[i]=High[i]-Low[i]+Point;}
         ArraySort (wrmassiv);
         i=MathFloor(minBar*Bars/100);
         StLevel=MathFloor(wrmassiv[i]/Point);
         i=MathFloor(maxBar*Bars/100);
         BigLevel=MathFloor(wrmassiv[i]/Point);
        }
     }

   if (ExtMaxBar>Bars) ExtMaxBar=Bars;
   if (ExtMaxBar>0) _maxbarZZ=ExtMaxBar; else _maxbarZZ=Bars;

// -------
// Gartley Patterns

   if ((ExtIndicator==11 && ExtGartleyTypeSearch>0) || PotencialsLevels_retXD<0 || (ExtIndicator!=11 && ExtGartleyOnOff==false)) PotencialsLevels_retXD=0;
   if (PotencialsLevels_retXD>2) PotencialsLevels_retXD=2;

   if (ExtIndicator==11 || ExtGartleyOnOff || PotencialsLevels_retXD>0)
     {
      ArrayInitialize(PeakCenaX,0);
      ArrayInitialize(PeakCenaA,0);
      ArrayInitialize(PeakCenaB,0);
      ArrayInitialize(PeakCenaC,0);
      ArrayInitialize(PeakCenaD,0);

      ArrayInitialize(PeakTimeX,0);
      ArrayInitialize(PeakTimeA,0);
      ArrayInitialize(PeakTimeB,0);
      ArrayInitialize(PeakTimeC,0);
      ArrayInitialize(PeakTimeD,0);

//      ArrayInitialize(__NamePatterns,"");
      ArrayInitialize(__D,0);
      ArrayInitialize(__PatColor,0);

      if (writeInfoPatternsToFileXML<0) writeInfoPatternsToFileXML=0;
      if (writeInfoPatternsToFileXML>2) writeInfoPatternsToFileXML=2;
      if (writeInfoPatternsToFileCSV<0) writeInfoPatternsToFileCSV=0;
      if (writeInfoPatternsToFileCSV>2) writeInfoPatternsToFileCSV=2;

      min_DeltaGartley = (1 - ExtDeltaGartley);
      max_DeltaGartley = (1 + ExtDeltaGartley);

      for (i=0;i<20;i++)
        {
         deltapatterns[2][i][0]=retpatterns[i]*min_DeltaGartley;
         deltapatterns[2][i][1]=retpatterns[i]*max_DeltaGartley;

         deltapatterns[1][i][0]=retpatterns[i]*(1 - ExtDelta);
         deltapatterns[1][i][1]=retpatterns[i]*(1 + ExtDelta);

         deltapatterns[0][i][0]=retpatterns[i]*(1 - ExtDeltaGartleyPRZ);
         deltapatterns[0][i][1]=retpatterns[i]*(1 + ExtDeltaGartleyPRZ);
        }

      if (CustomPattern>0)
        {
         minAC = min_DeltaGartley * minAC;
         minBD = min_DeltaGartley * minBD;
         minXB = min_DeltaGartley * minXB;
         minXD = min_DeltaGartley * minXD;

         maxAC = max_DeltaGartley * maxAC;
         maxBD = max_DeltaGartley * maxBD;
         maxXB = max_DeltaGartley * maxXB;
         maxXD = max_DeltaGartley * maxXD;
        }

//      countPat=33;
      countPat=ArraySize(namepatterns);

      if (readFromFileListPatterns<0) readFromFileListPatterns=0;
      if (readFromFileListPatterns>2) readFromFileListPatterns=2;
      if (readFromFileListPatterns>0) mreadFromFileListPatterns();
      if (writeToFileListPatterns) mwriteToFileListPatterns();

Есть идеи, как заставить этот индикатор или любой другой индикатор сканировать несколько пар и несколько таймфреймов?

...