📅 财经日历 📊 实时波动 📈 大盘云图 📶 行情走势 🆚 投机情绪 🚀 今日热点

    V-T&B

    axihe LV3
    2020-11-18 · 6143 阅读
    AUDUSDM30.png


    [pre]//+------------------------------------------------------------------+
    //|                                                        V-T&B.mq4 |
    //|                                           Don Lawson (don_forex) |
    //+------------------------------------------------------------------+
    #property copyright ""
    #property link      ""
    //----
    #property indicator_chart_window
    #property indicator_buffers 2
    #property indicator_color1 Red
    #property indicator_width1 2
    #property indicator_color2 Green
    #property indicator_width2 2
    //----
    extern double  WickRatio     =0.5;
    extern double  WickPercent   =50;
    extern int     JuicePeriod   =7;
    extern int JuiceLevelForAlert=5;
    //----
    extern bool Notify=false;
    extern bool UseNew=true;
    //----
    double VTop[];
    double VBottom[];
    double DistanceFromCandle;
    int    Level=5;

    datetime t=0;
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function                         |
    //+------------------------------------------------------------------+
    int init()
      {
    //---- indicators
       SetIndexStyle(0, DRAW_ARROW, EMPTY);
       SetIndexArrow(0, 234);
       SetIndexBuffer(0, VTop);
       SetIndexStyle(1, DRAW_ARROW, EMPTY);
       SetIndexArrow(1, 233);
       SetIndexBuffer(1, VBottom);
    //----
       return(0);
      }
    //+------------------------------------------------------------------+
    //| Custom indicator deinitialization function                       |
    //+------------------------------------------------------------------+
    int deinit()
      {
    //----
    //----
       return(0);
      }
    //+------------------------------------------------------------------+
    //|                                                                  |
    //+------------------------------------------------------------------+
    void SetVTop(int index)
      {
       double Juice, JuiceLevel;
    // Check for Juice
       JuiceLevel=Level*Point;
       if(Period()==5)
          JuiceLevel=JuiceLevel/2;
    //----
       Juice=iStdDev(NULL,0,JuicePeriod,MODE_EMA,0,PRICE_CLOSE,index)-JuiceLevel;
       if(Juice > JuiceLevelForAlert*Point)
         {
          VTop[index]=High[index]+ DistanceFromCandle;
          if(Notify)
             PlaySound("V-Top.wav");
         }
      }
    //+------------------------------------------------------------------+
    //|                                                                  |
    //+------------------------------------------------------------------+
    void SetVBottom(int index)
      {
       double Juice, JuiceLevel;
    // Check for Juice
       JuiceLevel=Level*Point;
       if(Period()==5)
          JuiceLevel=JuiceLevel/2;
    //----
       Juice=iStdDev(NULL,0,JuicePeriod,MODE_EMA,0,PRICE_CLOSE,index)-JuiceLevel;
       if(Juice > JuiceLevelForAlert*Point)
         {
          VBottom[index]=Low[index]- DistanceFromCandle;
          if(Notify)
             PlaySound("V-Bottom.wav");
         }
      }
    //+------------------------------------------------------------------+
    //| Custom indicator iteration function                              |
    //+------------------------------------------------------------------+
    int start()
      {
       int limit, i,State;
       double WickPenetration;
       double BullWickPenHi,BullWickPenLow;
       double BearWickPenHi,BearWickPenLow;
       double BullWickHi,BullWickLow,BullBody;
       double BearWickHi,BearWickLow,BearBody;
       int counted_bars=IndicatorCounted();
    //---- check for possible errors
       if(counted_bars<0)
          return(-1);
    //---- last counted bar will be recounted
       if(counted_bars>0)
          counted_bars--;
       limit=Bars-counted_bars;
    //----
       WickPenetration=WickPercent/100.0;
       DistanceFromCandle=Point*8;
       for(i=1; i<=limit; i++)
         {
          bool  CurrentBull    =false,
                CurrentBear    =false,
                Bull           =false,
                Bear           =false,
                HiWick         =false,
                LoWick         =false;
          //----
          if(Open[i-1]<Close[i-1])
             CurrentBull=true;
          else
             CurrentBear=true;
          if(Open<Close)
             Bull=true;
          else
             Bear=true;
          //----
          BullWickHi=High - Close;
          BullWickLow=Open - Low;
          BullBody=Close - Open;
          BearWickHi=High - Open;
          BearWickLow=Close - Low;
          BearBody=Open - Close;
          // Check for VTOP
          if(High > High[i+1])
            {
             if(Bull)
               {
                if((BullWickHi > BullBody * WickRatio)) // && (BullWickHi > BullWickLow)
                   HiWick=true;
               }
             if(Bear)
               {
                if((BearWickHi > BearBody * WickRatio)) // && (BearWickHi > BearWickLow)
                   HiWick=true;
               }
            }
          // Check for VBottom
          if(Low < Low[i+1])
            {
             if(Bull)
               {
                if((BullWickLow > BullBody * WickRatio)) // && (BullWickLow > BullWickHi)
                   LoWick=true;
               }
             if(Bear)
               {
                if((BearWickLow > BearBody * WickRatio)) // && (BearWickLow > BearWickHi)
                   LoWick=true;
               }
            }
          // Set up State Table
          if(CurrentBear && Bull)
             State=1;
          if(CurrentBear && Bear)
             State=2;
          if(CurrentBull && Bull)
             State=3;
          if(CurrentBull && Bear)
             State=4;
          // Set Arrow
          if(HiWick)
            {
             BullWickPenHi=Close + BullWickHi * WickPenetration;
             BearWickPenHi=Open + BearWickHi * WickPenetration;
             switch(State)
               {
                case 1 : // CurrentBear && Bull
                   if(UseNew)
                     {
                      if(Open[i-1] < BullWickPenHi)
                         SetVTop(i);
                     }
                   else
                     {
                      SetVTop(i);
                     }

                   break;
                case 2 : // CurrentBear && Bear
                   if(UseNew)
                     {
                      if(Open[i-1] < BearWickPenHi)
                         SetVTop(i);
                     }
                   else
                     {
                      SetVTop(i);
                     }
                   break;
                case  3 : // CurrentBull && Bull
                   if(UseNew)
                     {
                      if(Close[i-1] < BullWickPenHi)
                         SetVTop(i);
                     }
                   else
                     {
                      SetVTop(i);
                     }
                   break;
                case 4 : // CurrentBull && Bear
                   if(UseNew)
                     {
                      if(Close[i-1] < BearWickPenHi)
                         SetVTop(i);
                     }
                   else
                     {
                      SetVTop(i);
                     }
                   break;
               }
            }
          if(LoWick)
            {
             BullWickPenLow=Open - BullWickLow * WickPenetration;
             BearWickPenLow=Close - BearWickLow * WickPenetration;
             //----
             switch(State)
               {
                case 1 : // CurrentBear && Bull
                   if(UseNew)
                     {
                      if(Close[i-1] > BullWickPenLow)
                         SetVBottom(i);
                     }
                   else
                     {
                      SetVBottom(i);
                     }
                   break;
                case 2 : // CurrentBear && Bear
                   if(UseNew)
                     {
                      if(Close[i-1] > BearWickPenLow)
                         SetVBottom(i);
                     }
                   else
                     {
                      SetVBottom(i);
                     }
                   break;
                case 3 : // CurrentBull && Bull
                   if(UseNew)
                     {
                      if(Open[i-1] > BullWickPenLow)
                         SetVBottom(i);
                     }
                   else
                     {
                      SetVBottom(i);
                     }
                   break;
                case 4 : //CurrentBull && Bear)
                   if(UseNew)
                     {
                      if(Open[i-1] > BearWickPenLow)
                         SetVBottom(i);
                     }
                   else
                     {
                      SetVBottom(i);
                     }
                   break;
               }
            }
         }

       if(t!=Time[0])
         {
          if(VTop[1]<1111)
            {
             Alert(_Symbol+" Sell!!!");
             SendMail("Signal",_Symbol+" Sell!!!");
            }
          if(VBottom[1]<1111)
            {
             Alert(_Symbol+" Buy!!!");
             SendMail("Signal",_Symbol+" Buy!!!");
            }
          t=Time[0];
         }

       return(0);
      }
    //+------------------------------------------------------------------+
    //+------------------------------------------------------------------+
    [/pre]

    ""
    还没有人打赏,支持一下
    回复

    举报

     

    回答|共 54 个

    比我少奋斗 LV3

    发表于 2020-12-12 20:42:28 | 显示全部楼层

    支持下

    fa886f LV0

    发表于 2021-1-11 15:33:52 | 显示全部楼层

    支持下

    knnnxuum LV3

    发表于 2021-1-19 12:08:53 | 显示全部楼层

    支持下

    svvslatoq LV3

    发表于 2021-1-28 10:46:58 | 显示全部楼层

    顶下

    mengfanxin049 LV3

    发表于 2021-2-4 16:40:26 | 显示全部楼层

    顶下

    和了楼怀孕 LV3

    发表于 2021-2-6 19:08:46 | 显示全部楼层

    谢谢

    蓝色海域 LV3

    发表于 2021-2-15 15:59:34 | 显示全部楼层

    顶下

    汇股风云 LV4

    发表于 2021-2-17 13:56:41 | 显示全部楼层

    谢谢

    1444200516 LV3

    发表于 2021-2-20 18:01:58 | 显示全部楼层

    顶下
    您需要登录后才可以回帖 登录 | 注册

    提醒: 禁止引战、谩骂、灌水内容

    微信二维码

    有问题联系客服