私たちのファンページに参加してください
- ビュー:
- 1113
- 評価:
- パブリッシュ済み:
- 2017.02.17 10:08
- アップデート済み:
- 2023.03.30 13:44
-
このコードに基づいたロボットまたはインジケーターが必要なら、フリーランスでご注文ください フリーランスに移動
実際の著者: Eng. Waddah Attar
Waddah_Attar_Trend指標は、アラート、電子メール、及びプッシュ通知を備えています。
アラート、電子メールメッセージ、及びプッシュ通知を実装するために、指標コードは以下のように変更されました。
- 新しい入力パラメータの導入
//---- アラートのための入力 input uint NumberofBar=1; //シグナルのバー数 input bool SoundON=true; // アラートの有効化 input uint NumberofAlerts=2; // アラート数 input bool EMailON=false; // シグナルのメール送信の有効化 input bool PushON=false; // シグナルのモバイルデバイスへの送信の有効化
- 指標コードの最後でのBuySignal()、SellSignal()、GetStringTimeframe()の3つの新しい関数の追加 //+------------------------------------------------------------------+
//| 買いシグナル関数 |
//+------------------------------------------------------------------+
void BuySignal(string SignalSirname,// 電子メールとプッシュメッセージでの指標名のテキスト
double &ColorArray[],// 色インデックスバッファ
int ColorIndex,// 色インデックスバッファでのシグナル生成のための色インデックス
const int Rates_total, // 現在のバーの数
const int Prev_calculated, // 1つ前のティックでのバーの数
const double &Close[], // 終値
const int &Spread[]) // スプレッド
{
//---
static uint counter=0;
if(Rates_total!=Prev_calculated) counter=0;
bool BuySignal=false;
bool SeriesTest=ArrayGetAsSeries(ColorArray);
int index,index1;
if(SeriesTest)
{
index=int(NumberofBar);
index1=index+1;
}
else
{
index=Rates_total-int(NumberofBar)-1;
index1=index-1;
}
if(ColorArray[index1]!=ColorIndex && ColorArray[index]==ColorIndex) BuySignal=true;
if(BuySignal && counter<=NumberofAlerts)
{
counter++;
MqlDateTime tm;
TimeToStruct(TimeCurrent(),tm);
string text=TimeToString(TimeCurrent(),TIME_DATE)+" "+string(tm.hour)+":"+string(tm.min);
SeriesTest=ArrayGetAsSeries(Close);
if(SeriesTest) index=int(NumberofBar);
else index=Rates_total-int(NumberofBar)-1;
double Ask=Close[index];
double Bid=Close[index];
SeriesTest=ArrayGetAsSeries(Spread);
if(SeriesTest) index=int(NumberofBar);
else index=Rates_total-int(NumberofBar)-1;
Bid+=_Point*Spread[index];
string sAsk=DoubleToString(Ask,_Digits);
string sBid=DoubleToString(Bid,_Digits);
string sPeriod=GetStringTimeframe(ChartPeriod());
if(SoundON) Alert("BUY signal \n Ask=",Ask,"\n Bid=",Bid,"\n currtime=",text,"\n Symbol=",Symbol()," Period=",sPeriod);
if(EMailON) SendMail(SignalSirname+": BUY signal alert","BUY signal at Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod);
if(PushON) SendNotification(SignalSirname+": BUY signal at Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod);
}
//---
}
//+------------------------------------------------------------------+
//| 売りシグナル関数 |
//+------------------------------------------------------------------+
void SellSignal(string SignalSirname, // 電子メールとプッシュメッセージでの指標名のテキスト
double &ColorArray[], // 色インデックスバッファ
int ColorIndex, // 色インデックスバッファでのシグナル生成のための色インデックス
const int Rates_total, // 現在のバーの数
const int Prev_calculated, // 1つ前のティックでのバーの数
const double &Close[], // 終値
const int &Spread[]) // スプレッド
{
//---
static uint counter=0;
if(Rates_total!=Prev_calculated) counter=0;
bool SellSignal=false;
bool SeriesTest=ArrayGetAsSeries(ColorArray);
int index,index1;
if(SeriesTest)
{
index=int(NumberofBar);
index1=index+1;
}
else
{
index=Rates_total-int(NumberofBar)-1;
index1=index-1;
}
if(ColorArray[index1]!=ColorIndex && ColorArray[index]==ColorIndex) SellSignal=true;
if(SellSignal && counter<=NumberofAlerts)
{
counter++;
MqlDateTime tm;
TimeToStruct(TimeCurrent(),tm);
string text=TimeToString(TimeCurrent(),TIME_DATE)+" "+string(tm.hour)+":"+string(tm.min);
SeriesTest=ArrayGetAsSeries(Close);
if(SeriesTest) index=int(NumberofBar);
else index=Rates_total-int(NumberofBar)-1;
double Ask=Close[index];
double Bid=Close[index];
SeriesTest=ArrayGetAsSeries(Spread);
if(SeriesTest) index=int(NumberofBar);
else index=Rates_total-int(NumberofBar)-1;
Bid+=_Point*Spread[index];
string sAsk=DoubleToString(Ask,_Digits);
string sBid=DoubleToString(Bid,_Digits);
string sPeriod=GetStringTimeframe(ChartPeriod());
if(SoundON) Alert("SELL signal \n Ask=",Ask,"\n Bid=",Bid,"\n currtime=",text,"\n Symbol=",Symbol()," Period=",sPeriod);
if(EMailON) SendMail(SignalSirname+": SELL signal alert","SELL signal at Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod);
if(PushON) SendNotification(SignalSirname+": SELL signal at Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod);
}
//---
}
//+------------------------------------------------------------------+
//| 時間軸を文字列として取得 |
//+------------------------------------------------------------------+
string GetStringTimeframe(ENUM_TIMEFRAMES timeframe)
{
//----
return(StringSubstr(EnumToString(timeframe),7,-1));
//----
} - OnCalculate() ブロックで指標計算サイクルが終了した後のBuySignal() とSellSignal() 関数への2回の呼び出しの追加 //---
BuySignal("Waddah_Attar_Trend_Alert",ColorIndBuffer,0,rates_total,prev_calculated,close,spread);
SellSignal("Waddah_Attar_Trend_Alert",ColorIndBuffer,1,rates_total,prev_calculated,close,spread);
//---
ここで、ColorIndBufferは、線の色をインデックスの形で保存するための色インデックスバッファの名前で、0と1は色インデックスバッファ内の色の数です。
BuySignal() 及びSellSignal() 関数は指標コードのOnCalculate() ブロックで1回のみ呼び出されるものとします。
この指標は SmoothAlgorithms.mqhライブラリクラスを使用します(terminal_data_folder\MQL5\Include にコピーします)。このクラスの使用法の詳細については 「Averaging Price Series for Intermediate Calculations Without Using Additional Buffers(追加のバッファを使用しない中間計算のための価格のシリーズの平均化)」稿に記載があります。
図1 チャートでのWaddah_Attar_Trend_Alert指標
図2 Waddah_Attar_Trend_Alert指標のアラート生成
MetaQuotes Ltdによってロシア語から翻訳されました。
元のコード: https://www.mql5.com/ru/code/16832

このエキスパートアドバイザーは、前回の取引から得られた利益がEA入力で指定された閾値を上回った場合に、ポジションの数量を増加します。

このエキスパートアドバイザーは、決済逆指値を現在の価格から事前定義された距離に移動します。

このエキスパートアドバイザーは、フィボレベルとiSAR指標を利用するパラボラストップ&リバースシステムです。取引は買いリミット及び売りリミット注文を用いて行われます。

既存および新しいハーモニックチャートパターンを表示するための指標です。