诚信为本
量力而为
当前位置:峰汇在线 > MetaTrader 4 > MT4指标 > 正文

立体式分形信号 Fractals+Signal+diapazon.mq4

Fractals+Signal+diapazon 指标创建分形信号。

图表:Fractals+Signal+diapazon 指标

源码:

//+------------------------------------------------------------------+
//|                                     Fractals+Signal+diapazon.mq4 |
//+------------------------------------------------------------------+
#property copyright "Maloma"
#property link      "http://www.125808047.com"

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 OrangeRed
#property indicator_color4 CornflowerBlue
#property indicator_color5 Magenta
#property indicator_color6 Teal

double dUpFractalsBuffer[];
double dDownFractalsBuffer[];
double dUpSignalBuffer[];
double dDownSignalBuffer[];
double UpDiapazonBuffer[];
double DnDiapazonBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{  
    SetIndexBuffer(0,dUpFractalsBuffer);
    SetIndexBuffer(1,dDownFractalsBuffer);   
    SetIndexBuffer(2,dUpSignalBuffer);
    SetIndexBuffer(3,dDownSignalBuffer);   
    SetIndexBuffer(4,UpDiapazonBuffer);
    SetIndexBuffer(5,DnDiapazonBuffer);   

    SetIndexStyle(0,DRAW_ARROW,EMPTY,2);
    SetIndexArrow(0,119);
    SetIndexStyle(1,DRAW_ARROW,EMPTY,2);
    SetIndexArrow(1,119);
    SetIndexStyle(2,DRAW_ARROW,EMPTY,2);
    SetIndexArrow(2,241);
    SetIndexStyle(3,DRAW_ARROW,EMPTY,2);
    SetIndexArrow(3,242);
    SetIndexStyle(4,DRAW_SECTION,EMPTY,2);
    SetIndexStyle(5,DRAW_SECTION,EMPTY,2);

    SetIndexEmptyValue(0,0.0);
    SetIndexEmptyValue(1,0.0);
    SetIndexEmptyValue(2,0.0);
    SetIndexEmptyValue(3,0.0);
    SetIndexEmptyValue(4,0.0);
    SetIndexEmptyValue(5,0.0);

    SetIndexLabel(0,"Fractal Up");
    SetIndexLabel(1,"Fractal Down");
    SetIndexLabel(2,"Signal Up");
    SetIndexLabel(3,"Signal Down");
    SetIndexLabel(4,"Diapazon Up");
    SetIndexLabel(5,"Diapazon Down");

    IndicatorShortName("F5S");
   Comment("www.125808047.com");
   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[])
  {
    int i,nCountedBars;
    nCountedBars=IndicatorCounted();

    if(nCountedBars<0 || Bars<5) return(-1);

      i=Bars-nCountedBars-1;
    while(i>=0)
     {
          if(High[i+3]>High[i+3+1] && High[i+3]>High[i+3+2] && High[i+3]>High[i+3-1] && High[i+3]>High[i+3-2])
            {
             dUpSignalBuffer[i]= Low[i]-3*Point;
             dUpFractalsBuffer[i+3]= High[i+3];
             UpDiapazonBuffer[i]= Open[i];
             UpDiapazonBuffer[i+3]= High[i+3];
            }
          if(Low[i+3]<Low[i+3+1] && Low[i+3]<Low[i+3+2] && Low[i+3]<Low[i+3-1] && Low[i+3]<Low[i+3-2])
            {
             dDownSignalBuffer[i]= High[i]+3*Point;
             dDownFractalsBuffer[i+3]= Low[i+3];
             DnDiapazonBuffer[i]= Open[i];
             DnDiapazonBuffer[i+3]= Low[i+3];
             i--;
             continue;
            }

         if(High[i+3]==High[i+3+1] && High[i+3]>High[i+3+2] && High[i+3]>High[i+3+3] && High[i+3]>High[i+3-1] && High[i+3]>High[i+3-2])
            {
             dUpSignalBuffer[i]= Low[i]-3*Point;
             dUpFractalsBuffer[i+3]= High[i+3];
             UpDiapazonBuffer[i]= Open[i];
             UpDiapazonBuffer[i+3]= High[i+3];
            }
         if(Low[i+3]==Low[i+3+1] && Low[i+3]<Low[i+3+2] && Low[i+3]<Low[i+3+3] && Low[i+3]<Low[i+3-1] && Low[i+3]<Low[i+3-2])
            {
             dDownSignalBuffer[i]= High[i]+3*Point;
             dDownFractalsBuffer[i+3]= Low[i+3];
             DnDiapazonBuffer[i]= Open[i];
             DnDiapazonBuffer[i+3]= Low[i+3];
             i--;
             continue;
            }                      

         if(High[i+3]>=High[i+3+1] && High[i+3]==High[i+3+2] && High[i+3]>High[i+3+3] && High[i+3]>High[i+3+4] && High[i+3]>High[i+3-1] && 
            High[i+3]>High[i+3-2])
            {
             dUpSignalBuffer[i]= Low[i]-3*Point;
             dUpFractalsBuffer[i+3]= High[i+3];
             UpDiapazonBuffer[i]= Open[i];
             UpDiapazonBuffer[i+3]= High[i+3];
            }
         if(Low[i+3]<=Low[i+3+1] && Low[i+3]==Low[i+3+2] && Low[i+3]<Low[i+3+3] && Low[i+3]<Low[i+3+4] && Low[i+3]<Low[i+3-1] && 
            Low[i+3]<Low[i+3-2])
            { 
             dDownSignalBuffer[i]= High[i]+3*Point;
             dDownFractalsBuffer[i+3]= Low[i+3];
             DnDiapazonBuffer[i]= Open[i];
             DnDiapazonBuffer[i+3]= Low[i+3];
             i--;
             continue;
            }                  

         if(High[i+3]>=High[i+3+1] && High[i+3]==High[i+3+2] && High[i+3]==High[i+3+3] && High[i+3]>High[i+3+4] && High[i+3]>High[i+3+5] && 
            High[i+3]>High[i+3-1] && High[i+3]>High[i+3-2])
            {
             dUpSignalBuffer[i]= Low[i]-3*Point;
             dUpFractalsBuffer[i+3]= High[i+3];
             UpDiapazonBuffer[i]= Open[i];
             UpDiapazonBuffer[i+3]= High[i+3];
            }
         if(Low[i+3]<=Low[i+3+1] && Low[i+3]==Low[i+3+2] && Low[i+3]==Low[i+3+3] && Low[i+3]<Low[i+3+4] && Low[i+3]<Low[i+3+5] && 
            Low[i+3]<Low[i+3-1] && Low[i+3]<Low[i+3-2])
            {
             dDownSignalBuffer[i]= High[i]+3*Point;
             dDownFractalsBuffer[i+3]= Low[i+3];
             DnDiapazonBuffer[i]= Open[i];
             DnDiapazonBuffer[i+3]= Low[i+3];
             i--;
             continue;
            }                              

         if(High[i+3]>=High[i+3+1] && High[i+3]==High[i+3+2] && High[i+3]>=High[i+3+3] && High[i+3]==High[i+3+4] && High[i+3]>High[i+3+5] && 
            High[i+3]>High[i+3+6] && High[i+3]>High[i+3-1] && High[i+3]>High[i+3-2])
            {
             dUpSignalBuffer[i]= Low[i]-3*Point;
             dUpFractalsBuffer[i+3]= High[i+3];
             UpDiapazonBuffer[i]= Open[i];
             UpDiapazonBuffer[i+3]= High[i+3];
            }
         if(Low[i+3]<=Low[i+3+1] && Low[i+3]==Low[i+3+2] && Low[i+3]<=Low[i+3+3] && Low[i+3]==Low[i+3+4] && Low[i+3]<Low[i+3+5] && 
            Low[i+3]<Low[i+3+6] && Low[i+3]<Low[i+3-1] && Low[i+3]<Low[i+3-2])
            {
             dDownSignalBuffer[i]= High[i]+3*Point;
             dDownFractalsBuffer[i+3]= Low[i+3];
             DnDiapazonBuffer[i]= Open[i];
             DnDiapazonBuffer[i+3]= Low[i+3];
             i--;
             continue;
            }                        
      i--;
     }
   return(rates_total);
  }
//+------------------------------------------------------------------+
打赏
版权所有转载请注明标题及链接:峰汇在线 » 立体式分形信号 Fractals+Signal+diapazon.mq4
上一篇:
下一篇:
分享到: 更多 (0)

如您觉得此文不错请扫码打赏!

支付宝扫一扫打赏

微信扫一扫打赏