17评论

0收藏

求大神帮忙看下这个指标显示不了什么问题?谢谢

avatar 白开水 | 6924 人阅读 | 17 人评论 | 2015-06-12

#property indicator_chart_window
#define PREFIX "T3S"

#property indicator_buffers 2               
#property indicator_color1 Lime
#property indicator_color2 White

extern int    Snake_HalfCycle = 14;
extern int    T3Period        = 21;
extern int    T3Price         = PRICE_CLOSE;
extern double b               = 0.518;
extern string TimeFrame       = "current time frame";
extern bool   Indi_Lines      = true;
extern bool   Real            = true;
extern int    Arr_otstup      = 0;
extern int    Arr_width       = 2;
extern bool   AlertsMessage      = true;
extern bool   AlertsSound        = false;
extern bool   AlertsEmail        = false;
extern bool   AlertsNotification = false;
extern int    SignalBar          = 0;

int sig_alert=0;

double Sn[],T3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
    SetIndexBuffer(0,Sn);
    SetIndexLabel (0,"Sn");
   
    SetIndexBuffer(1,T3);
    SetIndexLabel (1,"T3");
if(Indi_Lines){   
    SetIndexStyle (0,DRAW_LINE);
    SetIndexStyle (1,DRAW_LINE);   
   }else{
    SetIndexStyle (0,DRAW_NONE);
    SetIndexStyle (1,DRAW_NONE);}   
   
    IndicatorShortName("T-S");
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   for(int i = ObjectsTotal()-1; i >= 0; i--)   
   if (StringSubstr(ObjectName(i), 0,
       StringLen(PREFIX)) == PREFIX)
       ObjectDelete(ObjectName(i));
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int i;
   int counted_bars=IndicatorCounted();
   int limit=Bars-counted_bars;
   
   if(Real)int snk=0; else snk=Snake_HalfCycle;

   for(i=0; i<limit+snk; i++)
   {
    Sn[i] = iCustom(Symbol(),0,"Snake",Snake_HalfCycle,0,i);
    T3[i] = iCustom(Symbol(),0,"T3_clean",T3Period,T3Price,b,TimeFrame,0,i);
   }
//+------------------------------------------------------------------+
for(i=0; i<limit+snk; i++)
  {   
  if(Sn[i+1]<T3[i+1] && Sn[i]>T3[i])
    arrows_wind(i,"T3+Snake_Up",Arr_otstup ,233,Lime,Arr_width,false);
    else ObjectDelete(PREFIX+"T3+Snake_Up"+TimeToStr(Time[i],TIME_DATE|TIME_SECONDS));
  
  if(Sn[i+1]>T3[i+1] && Sn[i]<T3[i])
    arrows_wind(i,"T3+Snake_Dn",Arr_otstup ,234,Red,Arr_width,true);
    else ObjectDelete(PREFIX + "T3+Snake_Dn" + TimeToStr(Time[i],TIME_DATE|TIME_SECONDS));
//-----------------------------------------------------------------------+
if(AlertsMessage || AlertsEmail || AlertsNotification || AlertsSound)
  {
   string message1 = ("T3+Snake - "+Symbol()+" TF("+Period()+") - Signal for BUY");
   string message2 = ("T3+Snake - "+Symbol()+" TF("+Period()+") - Signal for SELL");
      
    if(sig_alert!=1 && Sn[SignalBar+1]<T3[SignalBar+1] && Sn[SignalBar]>T3[SignalBar])
     {
        if (AlertsMessage) Alert(message1);
        if (AlertsEmail)   SendMail(Symbol()+" T3+Snake ",message1);
        if (AlertsNotification) SendNotification(message1);
        if (AlertsSound)   PlaySound("alert2.wav");
        sig_alert=1;
     }
    if(sig_alert!=2 && Sn[SignalBar+1]>T3[SignalBar+1] && Sn[SignalBar]<T3[SignalBar])
     {
        if (AlertsMessage) Alert(message2);
        if (AlertsEmail)   SendMail(Symbol()+" T3+Snake ",message2);
        if (AlertsNotification) SendNotification(message2);
        if (AlertsSound)   PlaySound("alert2.wav");
        sig_alert=2;
    }
   }
  }
//+------------------------------------------------------------------+
      return(0);
}
//====================================================================  
void arrows_wind(int k, string N,int ots,int Code,color clr, int ArrowSize,bool up)                 
{           
   string objName = PREFIX+N+TimeToStr(Time[k],TIME_DATE|TIME_SECONDS);
   double gap  = (3.0*iATR(NULL,0,20,k)/4.0)+ots*Point;
   
   ObjectCreate(objName, OBJ_ARROW,0,Time[k],0);
   ObjectSet   (objName, OBJPROP_COLOR, clr);  
   ObjectSet   (objName, OBJPROP_ARROWCODE,Code);
   ObjectSet   (objName, OBJPROP_WIDTH,ArrowSize);  
  if (up)
      ObjectSet(objName,OBJPROP_PRICE1,High[k]+gap);
     else  
      ObjectSet(objName,OBJPROP_PRICE1,Low[k]-gap);
}
//====================================================================   
""
还没有人打赏,支持一下

评论|共 17 个

白开水

发表于 2015-6-13 16:52:08 | 显示全部楼层

1

白开水

发表于 2015-6-13 16:52:14 | 显示全部楼层

2

白开水

发表于 2015-6-13 22:41:07 | 显示全部楼层

3

g3dfxpro

发表于 2015-6-13 23:12:54 | 显示全部楼层

snk沒有宣告

play9f

发表于 2015-8-29 21:14:02 | 显示全部楼层

顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶

姐就是这么靓

发表于 2020-7-9 12:25:19 | 显示全部楼层

学习了,不错

此生有你足够

发表于 2020-7-15 13:58:09 | 显示全部楼层

学习了,不错

fxsin2546260613

发表于 2020-7-22 19:47:57 | 显示全部楼层

帮你顶下哈!!

ofhht

发表于 2020-7-28 10:00:35 | 显示全部楼层

帮你顶下哈!!

12下一页
您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则