//+------------------------------------------------------------------+ //| Фунт Покупка.mqh | //| Copyright 2016, Yury V. Reshetov | //| http://yury-reshetov.com/forum/55 | //+------------------------------------------------------------------+ #property copyright "Copyright 2016, Yury V. Reshetov" #property link "http://yury-reshetov.com/forum/55" #property indicator_chart_window #property indicator_buffers 15 double Buffer5[]; double Buffer6[]; int b; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { SetIndexStyle(5,DRAW_ARROW,STYLE_SOLID,2,Blue); SetIndexArrow(5,241);// DaDA SetIndexBuffer(5,Buffer5);// Назначение массива буферу SetIndexEmptyValue(5,0.0); SetIndexStyle(6,DRAW_ARROW,STYLE_SOLID,2,Blue); SetIndexArrow(6,242);// NetNet SetIndexBuffer(6,Buffer6);// Назначение массива буферу SetIndexEmptyValue(6,0.0); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnCalculate( const int rates_total, // размер входных таймсерий const int prev_calculated, // обработано баров на предыдущем вызове const datetime& time[], // Time const double& open[], // Open const double& high[], // High const double& low[], // Low const double& close[], // Close const long& tick_volume[], // Tick Volume const long& volume[], // Real Volume const int &spread[] // Spread ) { int i,limit,K=5,K1=5; int counted_bars=IndicatorCounted(); if(counted_bars<1) limit=Bars-1; else limit=Bars-counted_bars; if(b!=Bars) { b=Bars; for(i=limit-1; i>=1; i--) { double VOL=iCustom(NULL,0,"eVOLution-dvoid.1.3 (1)",1,i); double OPN=iCustom(NULL,0,"eVOLution-dvoid.1.3 (1)",2,i); double Signal=iCustom(NULL,0,"TDSEQUENTA v2015",K,K1,12,6,i); if((Signal>0) && (VOL>0) && (OPN<0)) { double PONT=iCustom(NULL,0,"TDSEQUENTA v2015",K,K1,12,5,i); if(PONT==1) PONT=2; if((PONT<5)) PONT=4; if((PONT>4) && (PONT<11)) PONT=7; if((PONT>10)) PONT=14; double v0=iCustom(NULL, 0, "ClusterX_CumDelta1","6A 03-17",0,i)-iCustom(NULL, 0, "ClusterX_CumDelta1","6A 03-17",0,i+PONT); double v1=iCustom(NULL, 0, "ClusterX_CumDelta1","6J 03-17",0,i)-iCustom(NULL, 0, "ClusterX_CumDelta1","6J 03-17",0,i+PONT); double v2=iCustom(NULL, 0, "ClusterX_CumDelta1","DX 03-17",0,i)-iCustom(NULL, 0, "ClusterX_CumDelta1","DX 03-17",0,i+PONT); double v3=iCustom(NULL, 0, "ClusterX_CumDelta1","6E 03-17",0,i)-iCustom(NULL, 0, "ClusterX_CumDelta1","6E 03-17",0,i+PONT); double v4=iCustom(NULL, 0, "ClusterX_CumDelta1","6N 03-17",0,i)-iCustom(NULL, 0, "ClusterX_CumDelta1","6N 03-17",0,i+PONT); if(getTernaryClassificator(v0,v1,v2,v3,v4)>0){Buffer5[i]=Low[i]-150*Point;} if(getTernaryClassificator(v0,v1,v2,v3,v4)<=0){Buffer6[i]=High[i]+150*Point;} } } } return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double getBinaryClassificator1(double v0,double v1,double v2,double v3,double v4) { double x0 = 2.0 * (v0 + 572.0) / 624.0 - 1.0; double x1 = 2.0 * (v1 + 292.0) / 593.0 - 1.0; double x2 = 2.0 * (v2 + 82.0) / 105.0 - 1.0; double x3 = 2.0 * (v3 + 380.0) / 400.0 - 1.0; double x4 = 2.0 * (v4 + 137.0) / 632.0 - 1.0; double decision=0.17824488692192567*sigmoid(x0+x2+x3) -0.054966091303148834*sigmoid(x2+x4) +0.9576268463707119*sigmoid(x0+x2+x4) -0.0809056419894887*sigmoid(1.0+x0+x1+x2+x3+x4); return decision; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double sigmoid(double x) { if(MathAbs(x)<1.0) { return 2.0 * signum(x) - x; } return signum(x); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double getBinaryClassificator2(double v0,double v1,double v2,double v3,double v4) { double x0 = 2.0 * (v0 + 1012.0) / 973.0 - 1.0; double x1 = 2.0 * (v1 + 480.0) / 807.0 - 1.0; double x2 = 2.0 * (v2 + 75.0) / 289.0 - 1.0; double x3 = 2.0 * (v3 + 367.0) / 852.0 - 1.0; double x4 = 2.0 * (v4 + 179.0) / 242.0 - 1.0; double decision=0.3581212719928972*sigmoid(x0+x2) + 0.17596568670359763 * sigmoid(x1 + x2 + x4) + 0.16097612824969676 * sigmoid(x2 + x3 + x4) + 0.006383723692931011 * sigmoid(x1 + x2 + x3 + x4) -0.0939801673148345*sigmoid(1.0+x1+x2) +0.3925333566757118*sigmoid(1.0+x1+x4); return decision; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double signum(double x) { if(x==0.0) { return 0.0; } if(x>0.0) { return 1.0; } return -1.0; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int getTernaryClassificator(double x0,double x1,double x2,double x3,double x4) { double result1 = getBinaryClassificator1(x0, x1, x2, x3, x4); double result2 = getBinaryClassificator2(x0, x1, x2, x3, x4); if((result1*result2)>0.0) { if(result1>0.0) { return(1); } else { return(0); } } return(-1); } //+------------------------------------------------------------------+