编码帮助 - 页 775

 

请帮助我解决这个问题。

下面是MA交叉警报,但我在同一个通知中得到了太多的信息。

我只想在每两个连续的条形图中得到一个通知,这意味着在下一个警报之前要跳过两个条形图

我该怎么做呢,请帮助我。非常感谢您



//+------------------------------------------------------------------+

//|                MA Cross Arrows.mq4                               |

//|                Copyright © 2006  Scorpion@fxfisherman.com        |

//+------------------------------------------------------------------+

#property copyright "FxFisherman.com"

#property link      "http://www.fxfisherman.com"



#property indicator_chart_window

#property indicator_buffers 3

#property indicator_color1 Blue

#property indicator_color2 White

#property indicator_color3 Red



extern int Crossed_Pips = 0;

extern int MA_Period = 21;

extern int MA_Type = MODE_SMA;

extern int Shift_Bars=0;

extern int Bars_Count= 1000;

int state;

  

//---- buffers

double v1[];

double v2[];

double v3[];

  





int start()

 {

  double ma;

  int previous;

  int i;

  int shift;

  bool crossed_up, crossed_down;

  int totalBars = Bars - (MA_Period * 2);

  

  if (Bars_Count > 0 && Bars_Count <= totalBars)

  {

    i = Bars_Count;

  }else if(totalBars <= 0 ) {

    return(0);

  }else{

    i = totalBars;

  }

  

  while(i>=0)

   {

    shift = i + Shift_Bars;

    ma = iMA(Symbol(), Period(), MA_Period, 0, MA_Type, PRICE_CLOSE, shift);

    crossed_up = High[shift] >= (ma + (Crossed_Pips * Point));

    crossed_down = Low[shift] <= (ma - (Crossed_Pips * Point));



    v1[i] = NULL;

    v2[i] = NULL;    

    v3[i] = ma;

    if (crossed_up && previous != 1) {

      v1[i] = ma + (Crossed_Pips * Point);

      previous = 1;

    }else if(crossed_down && previous != 2){

      v2[i] = ma - (Crossed_Pips * Point);

      previous = 2;

    }

 

    i--;

   }

   

   ma = iMA(Symbol(), Period(), MA_Period, 0, MA_Type, PRICE_CLOSE, 0);

   if (Close[0] >= ma + (Crossed_Pips * Point) && state != 1) { 

      state = 1;

      SendNotification(Symbol() + "M"+_Period + " Price crossed UP EMA21.");

   }else if (Close[0] <= ma - (Crossed_Pips * Point) && state != -1) {

      state = -1;

      SendNotification(Symbol() + "M"+_Period + " Price cross DOWN the EMA21.");

   }



   return(0);

 }
 

当我声明一个extern变量时,我得到一个错误信息 "extern-unexpected token"

请帮助我

附加的文件:
error1.zip  116 kb
 
Ricardo Schuller:

当我声明一个extern变量时,我得到一个错误信息 "extern-unexpected token"

请帮助我

你不能在方法或函数 中使用extern。

 

如何修复错误?

 
Mo3tasemovic:

如何修复错误?

" GBPUSD"

 
Keith Watford:

" GBPUSD"

谢谢

 
pivboll:

需要帮助来修改一个指标

我试图修改一个MACD指标,将其变成Buff Dormeier书中描述的趋势推力指标,用成交量分析投资。

我在变量方面有问题,不能取得一个像样的结果。我在此附上正在工作的volWMA和VW MACD。

以下是描述

趋势推力指标

趋势推力指标(Tti)是成交量加权移动平均线收敛/背离(VW-MACD)指标的增强版,在我的《用成交量分析投资》一书中介绍过。Tti以独特的方式使用成交量乘数,夸大了成交量对成交量加权移动平均线的影响。与VW-Macd一样,Tti使用成交量加权移动平均线,而不是指数 移动平均线。成交量加权平均数按比例衡量每个时间段的收盘价和成交量,所以Tti更重视那些成交量大的价格趋势,而对成交量小的时间段则不重视。在2001年2月的《股票与商品》杂志中,我展示了成交量加权移动平均线(Buff averages,或Vwmas)在提高简单移动平均线的可靠性的同时,也改善了反应能力。

像Macd和VW-Macd一样,Tti通过从长(慢)平均线中减去短(快)平均线来计算一个价差。这个价差与成交量乘数相结合,形成了Buff价差。

计算方法如下

成交量乘数=快速VolWMA/慢速VolWMA

成交量乘数被取为二次幂,然后乘以快速VolWMA,得到成交量增强的快速平均值

成交量乘数被取为二次方,然后乘以慢速VolWMA,得到增强型慢速平均成交量。

TTi = 增强快速平均值-增强慢速平均值

谢谢您的帮助

指标链接:https://www.sendspace.com/file/rfy2dv

你好,我的朋友。你是否已经解决了TTI的问题?你能在这里分享或通过PM发给我吗?谢谢

 
Hi
你能帮助我解决这个问题吗?
我需要一个EA,在1分钟的时间内,当价格与金俊森(一目了然)的差价大于3点(30点)时,发送推送通知
 

尊敬的先生,您好。


请为该指标增加声音警报、信息警报和手机通知 选项。

谢谢

附加的文件:
 

尊敬的各位领导

我发现了类似于 "iCustom返回错误值 "的主题,但这有点不同。

我试图创建一个指标,比较一个序列中相同类型的条形(牛/熊型)的大小。

并在柱状图中显示比较的最大值。

像这样。

max_value

//-----------------------------

使用ArrayMaximum,结果更快。但我的代码有问题,例如。

iCustom_diff

这里是比较iCustom值并返回错误值的代码。

#property indicator_separate_window
#property indicator_buffers 4


#property indicator_color1 DeepSkyBlue
#property indicator_width1 10


#property indicator_color2 Red
#property indicator_width2 10



#property indicator_color3 DodgerBlue
#property indicator_width3 4


#property indicator_color4 Crimson
#property indicator_width4 4


#property indicator_level1 0
#property indicator_levelcolor White
#property indicator_levelstyle 0


string LF = "\n";  // use this in custom or utility blocks where you need line feeds
int ObjCount = 0;  // count of all objects created on the chart, allows creation of objects with unique names
int current = 0; // variable points to current bar


double Buffer1[];
double Buffer2[];

double Buffer3[];
double Buffer4[];


double bar_0;
double bar_1;
double bar_2;
double bar_3;
double bar_4;
double bar_5;
double bar_6;
double bar_7;
double bar_8;
double bar_9;
double bar_10;
double bar_11;


//+------------------------------------------------------------------+
int init()
{
    if (false) ObjectsDeleteAll();      // clear the chart

    IndicatorDigits(Digits-5);
    IndicatorBuffers(4);
    
    SetIndexBuffer(0, Buffer1);
    SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID);
    
    SetIndexBuffer(1, Buffer2);
    SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID);
    
    
    
    
    SetIndexBuffer(2, Buffer3);
    SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID);
    
    SetIndexBuffer(3, Buffer4);
    SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID);
    
    
    return(0);
}


//+------------------------------------------------------------------+
int deinit()
{
if (false) ObjectsDeleteAll();

return(0);
}


//+------------------------------------------------------------------+
int start()
{
OnEveryTick1();

return(0);
}
//+------------------------------------------------------------------+
void OnEveryTick1()
{
    
    int i;
    int counted_bars = IndicatorCounted();
    if(counted_bars < 0) return(-1);
    if(counted_bars > 0) counted_bars--;
    i = Bars - counted_bars - 1;
    // main calculation loop
    while (i >= 0)
    
{
current = i;
        
//current  >0
//current+1=0
TechnicalAnalysis00();

//current  >0
//current+1>0
//current+2=0
TechnicalAnalysis01();

//current  >0
//current+1>0
//current+2>0
//current+3=0
TechnicalAnalysis02();


i--;
}
}

//-----------------------------------------------------
//---------bar_0-------------------------------
//-----------------------------------------------------
void TechnicalAnalysis00()
{

bar_0 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current);
bar_1 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+1);

if
(
bar_0 > 0
&&
bar_1 == 0
)

{
Histogram00();
}

}

void Histogram00()
{
Buffer1[current]= bar_0;
}
//-----------------------------------------------------
//---------bar_1-------------------------------
//-----------------------------------------------------
void TechnicalAnalysis01()
{

bar_0 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current);
bar_1 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+1);
bar_2 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+2);

if
(
bar_0 > 0
&&
bar_1 > 0
&&
bar_2 == 0
)

{
Histogram01();
}

}

void Histogram01()
{
int x_up_01[] = {0,0};

x_up_01[0] = bar_0;
x_up_01[1] = bar_1;

int maxValue_01 = ArrayMaximum(x_up_01);

Buffer1[current]= x_up_01[maxValue_01];
}
//-----------------------------------------------------
//---------bar_2-------------------------------
//-----------------------------------------------------
void TechnicalAnalysis02()
{

bar_0 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current);
bar_1 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+1);
bar_2 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+2);
bar_3 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+3);

if
(
bar_0 > 0
&&
bar_1 > 0
&&
bar_2 > 0
&&
bar_3 == 0
)

{
Histogram02();
}

}

void Histogram02()
{
int x_up_02[] = {0,0,0};

x_up_02[0] = bar_0;
x_up_02[1] = bar_1;
x_up_02[2] = bar_2;

int maxValue_02 = ArrayMaximum(x_up_02);

Buffer1[current]= x_up_02[maxValue_02];
}
//-----------------------------------------------------
//---------bar_3--------and so on-----------------------
//-----------------------------------------------------

我的错误在哪里?如何解决?
我试着用所有的外部参数调用iCustom,结果也是错误的。我试着用没有外部参数的iCustom--同样的错误结果。

谢谢你的帮助

主代码(第一个柱状图)和基于它的第二个代码(第二个柱状图)。

原因: