指标切换周期才会有声音预警,图片,源码,请老师修改
必须手动切换才有声音,奇怪了,请老师修改//+------------------------------------------------------------------+
//| 15mkd4.mq4 |
//| 好好学习 |
//| 天天向上 |
//+------------------------------------------------------------------+
#property copyright "好好学习"
#property link "天天向上"
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 White
#property indicator_color2 Yellow
#property indicator_color3 Red
#property indicator_color4 Red
extern int Periods=15;
extern int k=8;
extern int d=5;
extern int s=3;
double Line[],Line1[],Arrow[],Arrow2[];
int Flag1=0,Flag2=0;
int init()//初始化函数
{
IndicatorBuffers(4);
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_ARROW);
SetIndexStyle(3,DRAW_ARROW);
SetIndexArrow(2,233);
SetIndexArrow(3,234);
SetIndexBuffer(0,Line);
SetIndexBuffer(1,Line1);
SetIndexBuffer(2,Arrow);
SetIndexBuffer(3,Arrow2);
return(0);
}
int deinit()//反初始化函数
{
ObjectsDeleteAll();
return(0);
}
int start()
{
int i;
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for (i=limit-1;i>=0;i--)
{
Line=iStochastic (NULL, Periods, k, d, s, MODE_SMA, 0, MODE_SIGNAL, i);
Line1=iStochastic (NULL, Periods, k, d, s, MODE_SMA, 0, MODE_MAIN, i) ;
}
for (i=limit-1;i>=0;i--)
{
if(Line1<Line && Line1>Line)
Arrow=Line-5*Point;
}
for (i=limit-1;i>=0;i--)
{
if(Line1>Line && Line1<Line)
Arrow2=Line-5*Point;
}
if(Arrow>0.0)
{
if(Flag1==0)
{
Flag1=1;
Alert("出现向上箭头!");
}
}else Flag1=0;
if(Arrow2<0.0)
{
if(Flag2==0)
{
Flag2=1;
Alert("出现向下箭头!");
}
}else Flag2=0;
return(0);
必须手动切换周期 才有声音
有没有懂的,会修改的,帮弟兄一下 这个东西好 这个看着是比较不错的,有源码,谢谢分享,下来学习
页:
[1]