コーディングのヘルプ - ページ 775

 

この問題を解決してください。

下の図はMAクロスアラートですが、1つの同じ通知に多くのメッセージが表示されます。

私は2つの連続したバーごとに1つの通知を受けたいのですが、それは次の警告の前にスキップするバーの数が 2であることを意味します。

どうすればいいのでしょうか、よろしくお願いします。ありがとうございました。



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

//|                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:

インジケータの修正について

Buff Dormeierの著書「Investing with Volume Analysis」で説明されているように、MACDインディケータをトレンドスラストインディケータに変更しようとしているのです。

変数に問題があり、まともな結果を得ることができません。動作しているvolWMAとVW MACDを添付します。

以下はその説明です。

トレンドスラストインディケータ

トレンドスラストインディケータ(Tti)は、ボリューム加重移動平均収束・発散(VW-Macd)インディケータの強化版で、私の著書「ボリューム分析による投資」で紹介されました。Ttiは、出来高加重移動平均に対する出来高の影響を誇張するため に、独自の方法で出来高倍率を使用します。VW-Macdと同様に、Ttiは指数 移動平均ではなく、出来高加重移動平均を使用します。出来高加重平均は、終値と各時間の出来高が比例するため、出来高の多い時間帯をより重視し、出来高の少ない時間帯はあまり重視しない。Stocks & Commoditiesの2001年2月号で、出来高加重移動平均(Buff averages, Vwmas)が単純移動平均の信頼性を高めつつ、反応性を向上させることを示しました。

Ttiは、MacdやVW-Macdと同様に、ロング(遅い)平均からショート(速い)平均を引くことでスプレッドを計算します。このスプレッドと出来高倍率を組み合わせて、バフ・スプレッドを作成します。

計算方法は以下の通りです。

出来高倍率 = fast VolWMA / slow VolWMA

出来高倍率を2乗し、速いVolWMAを掛けると、出来高が速い平均を上回ります。

体積倍率の2乗に低速VolWMAを掛けたものが、低速平均を高める体積となります。

TTi = 速い平均を強化する - 遅い平均を強化する

ご協力ありがとうございました。

インジケータリンク: https://www.sendspace.com/file/rfy2dv

こんにちは、私の友人。あなたは今までTTIを整理しましたか?ここで共有するか、PMで私に送ってもらえますか?ありがとうございます。

 
Hi
この問題を解決するためにplzを助けてください
1分足で金運銭と買値の差が3ピップス(30ポイント)以上になるとプッシュ通知して くれるEAが欲しいのですが。
 

はーい。


このインジケータにサウンドアラート、メッセージアラート、モバイル通知 オプションを追加してください。

ありがとうございます。

ファイル:
 

こんにちは。

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をすべてのextern paramで呼び出そうとしましたが、同じ間違った結果でした。iCustomをextern param.無しで呼び出そうとしましたが、同じ間違った結果でした。

ありがとうございました。

メインコード(最初のヒストグラム)とそれに基づく2番目のコード(2番目のヒストグラム) :