Тестер стратегий позволяет тестировать и оптимизировать торговые стратегии (советники) перед началом использования их в реальной торговле. При тестировании советника происходит его однократная прогонка с начальными параметрами на исторических данных. При оптимизации торговая стратегия прогоняется несколько раз с различным набором параметров...
string err_text=(TerminalInfoString(TERMINAL_LANGUAGE)=="Russian")?
"Параметр \"Midle\" меньше 1!":
"Parameter \"Midle\" is less than 1!";
次のようになります。
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit()
{
//--- check "MA averaging period" parameterif(PeriodEMA<1)
{
string err_text=(TerminalInfoString(TERMINAL_LANGUAGE)=="Russian")?
"Параметр \"MA averaging period\" меньше 1!":
"Parameter \"MA averaging period\" is less than 1!";
//--- when testing, we will only output to the log about incorrect input parametersif(MQLInfoInteger(MQL_TESTER))
{
Print(__FILE__," ",__FUNCTION__,", ERROR: ",err_text);
return(INIT_FAILED);
}
else// if the Expert Advisor is run on the chart, tell the user about the error
{
Alert(__FILE__," ",__FUNCTION__,", ERROR: ",err_text);
return(INIT_PARAMETERS_INCORRECT);
}
}
//--- check "Min" parameterif(Min<1)
{
err_text=(TerminalInfoString(TERMINAL_LANGUAGE)=="Russian")?
"Параметр \"Min\" меньше 1!":
"Parameter \"Min\" is less than 1!";
//--- when testing, we will only output to the log about incorrect input parameters
//+------------------------------------------------------------------+//| Phoenix.mq4 |//| Copyright 2020, MetaQuotes Software Corp. |//| https://www.mql5.com |//+------------------------------------------------------------------+//--- setting the indicator name#property description"Phoenix"//--- set the strict mode of compilation#property strict//--- specify where to draw the indicator#property indicator_chart_window//--- specify the number of buffers#property indicator_buffers2//--- setting the color of the indicator rendering#property indicator_color1clrGreenYellow#property indicator_color2clrRed//--- we define the input parameters//--- specify arrays of indicator buffersdouble arrow_01[];
double arrow_02[];
//*********************************************//bool flag_buy = false;
bool flag_sell = false;
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit(void)
{
string short_name;
//--- we specify two additional buffers for calculations
IndicatorBuffers(2);
SetIndexBuffer(0,arrow_01);
SetIndexBuffer(1,arrow_02);
//--- setting the indicator to be drawn as a line
SetIndexStyle(0,DRAW_ARROW,EMPTY,2,clrGreenYellow);
SetIndexArrow(0,233);
SetIndexBuffer(0,arrow_01);
SetIndexStyle(1,DRAW_ARROW,EMPTY,2,clrRed);
SetIndexArrow(1,234);
SetIndexBuffer(1,arrow_02);
//--- setting a name in the DataWindow window and a label
short_name="Phoenix";
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
//--- if there are no errors,initialization is completed successfullyreturn(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Phoenix |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime& time[],
constdouble& open[],
constdouble& high[],
constdouble& low[],
constdouble& close[],
constlong& tick_volume[],
constlong& volume[],
constint& spread[])
{
for(int shift=rates_total; shift>=0; shift--)
{
//--- to simplify the coding and speed up access data are put into internal variablesdouble MacdCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,shift);
double SignalCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,shift);
{
if(flag_buy==false)
//--- check for long position (BUY) possibilityif(MacdCurrent>SignalCurrent)
{
arrow_01[shift]=Low[shift];
flag_buy=true;
flag_sell=false;
}
if(flag_sell==false)
//--- check for short position (SELL) possibilityif(MacdCurrent<SignalCurrent)
{
arrow_02[shift]=High[shift];
flag_buy=false;
flag_sell=true;
}
}
}
return(rates_total);
}
//+------------------------------------------------------------------+
В стрелочном индикаторе Phoenix используется комбинация трех индикаторов: Moving Average, Bolinger Bands и Momentum в сочетании с двумя мощными формулами, основанными на поведении цены текущего графика. В индикаторе Phoenix также реализована система звуковых и текстовых алертов, а также отправка...
//+------------------------------------------------------------------+//| Phoenix.mq4 |//| Copyright 2020, MetaQuotes Software Corp. |//| https://www.mql5.com |//+------------------------------------------------------------------+//--- setting the indicator name#property description"Phoenix"//--- set the strict mode of compilation#property strict//--- specify where to draw the indicator#property indicator_chart_window//--- specify the number of buffers#property indicator_buffers2//--- setting the color of the indicator rendering#property indicator_color1clrGreenYellow#property indicator_color2clrRed//--- we define the input parameters//--- specify arrays of indicator buffersdouble arrow_01[];
double arrow_02[];
//*********************************************//bool flag_buy = false;
bool flag_sell = false;
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit(void)
{
string short_name;
//--- we specify two additional buffers for calculations
IndicatorBuffers(2);
SetIndexBuffer(0,arrow_01);
SetIndexBuffer(1,arrow_02);
//--- setting the indicator to be drawn as a line
SetIndexStyle(0,DRAW_ARROW,EMPTY,2,clrGreenYellow);
SetIndexArrow(0,233);
SetIndexBuffer(0,arrow_01);
SetIndexStyle(1,DRAW_ARROW,EMPTY,2,clrRed);
SetIndexArrow(1,234);
SetIndexBuffer(1,arrow_02);
//--- setting a name in the DataWindow window and a label
short_name="Phoenix";
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
//--- if there are no errors,initialization is completed successfullyreturn(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Phoenix |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime& time[],
constdouble& open[],
constdouble& high[],
constdouble& low[],
constdouble& close[],
constlong& tick_volume[],
constlong& volume[],
constint& spread[])
{
for(int shift=rates_total; shift>=0; shift--)
{
//--- to simplify the coding and speed up access data are put into internal variablesdouble MacdCurrent=iCustom(NULL,0,"LeManTrend",13,21,34,3,MODE_MAIN,shift);
double SignalCurrent=iCustom(NULL,0,"LeManTrend",13,21,34,3,MODE_SIGNAL,shift);
{
if(flag_buy==false)
//--- check for long position (BUY) possibilityif(MacdCurrent>SignalCurrent)
{
arrow_01[shift]=Low[shift];
flag_buy=true;
flag_sell=false;
}
if(flag_sell==false)
//--- check for short position (SELL) possibilityif(MacdCurrent<SignalCurrent)
{
arrow_02[shift]=High[shift];
flag_buy=false;
flag_sell=true;
}
}
}
return(rates_total);
}
//+------------------------------------------------------------------+
こんにちは 2020.10.28_05:19:00 GMT+3です。LeManTrend_Indicator.mq5 のインジケータを4番目のバージョン .mq4 に翻訳しました。チャート上にインジケータは表示されますが、GBPUSD,H1からM5のタイムフレームに切り替えようとすると、MetaTrader4がハングアップし、CPUに負荷がかかっています。MetaTrader4を一度終了し、再度開く必要があります。チャートからLeManTrend_Indicator.ex4を削除してもフリーズしない。インジケーターのコードのどこがおかしいのか理解できません。どなたかヒントを教えてください。どうすれば直るのか?
そして、第4版に変換したLeMan_BrainTrend1Sig.mq5は、インジケーターのリストにはありますが、チャートには何も表示されません。このインジケーターのコードをどう書き換えたら正常に動作するようになるのか、私にはわかりません。以前、Expert Advisorだけを書きました。ストラテジーテスターで 確認する方法ですねー。そして、コード中に変数のPrint()を書くと、何が問題なのかが明らかになる。インジケーターの確認方法がわからない。コードにPrint()を書いたが、どのログにも保存されない。ハードディスクのスペースを取らないように、インジケータを動作させるためにどうしたらいいか、誰かアドバイスしてくれませんか?ご連絡をお待ちしております。05:44 GMT+3。
はい、今すぐインジケーターコードを掲載します。もうひとつ。なぜ.mq5から.mq4に変換したのですか?私のブローカーではルーブルの口座はMetaTrader4のみだからです。そして、指標は第5版で書かれています。そして、私はMetaTrader4用の収益性の高いExpert Advisorを書くために指標が必要です。今はそれでいい。05:53 GMT+3。
こんにちは!2020.10.28_05:19:00 GMT+3です。LeManTrend_Indicator.mq5 のインジケータを4番目のバージョン .mq4 に翻訳しました。チャート上にインジケータは表示されますが、GBPUSD,H1からM5のタイムフレームに切り替えようとすると、MetaTrader4がハングアップし、CPUに負荷がかかっています。MetaTrader4を一度終了し、再度開く必要があります。チャートからLeManTrend_Indicator.ex4を削除してもフリーズしない。インジケーターのコードのどこがおかしいのか理解できません。どなたかヒントを教えてください。どうすれば直るのか?
そして、第4版に変換したLeMan_BrainTrend1Sig.mq5は、インジケーターのリストにはありますが、チャートには何も表示されません。このインジケーターのコードをどう書き換えたら正常に動作するようになるのか、私にはわかりません。以前、Expert Advisorだけを書きました。ストラテジーテスターで 確認する方法ですねー。そして、コード中に変数のPrint()を書くと、何が問題なのかが明らかになる。インジケーターの確認方法がわからない。コードにPrint()を書いたが、どのログにも保存されない。ハードディスクのスペースを取らないように、インジケータを動作させるためにどうしたらいいか、誰かアドバイスしてくれませんか?ご連絡をお待ちしております。05:44 GMT+3。
はい、今すぐインジケーターコードを掲載します。もうひとつ。なぜ.mq5から.mq4に変換したのですか?私のブローカーではルーブルの口座はMetaTrader4のみだからです。そして、指標は第5版で書かれています。そして、私はMetaTrader4用の収益性の高いExpert Advisorを書くために指標が必要です。今はそれでいい。05:53 GMT+3。
LeManTrend_Indicator.mq5- インジケーター本体はこちらhttps://www.mql5.com/ru/code/27570
4でも動作しますが、(err_text)の前にある繰り返しの(string)を削除する必要があります。
次のようになります。
LeManTrend_Indicator.mq5- インジケーター本体はこちらhttps://www.mql5.com/ru/code/27570
4でも動作しますが、(err_text)の前にある繰り返しの(string)を削除する必要があります。
のようになるはずです。
列
BrainTrend1Sigを 4名様にプレゼント -https://www.mql5.com/ru/code/8772
こちらは、すでに修正された4用のLeManTrend_Indicator.mq4が 含まれているはずです。
BrainTrend1Sigを 4名様にプレゼント -https://www.mql5.com/ru/code/8772
ここでLeManTrend_Indicator.mq4 を追加する必要があります(4 で修正済み)。
エラーが発生しました - この行を削除してください ( double const = 0; )
で、すべてがうまくいく
お笑い芸人なんですね。
誰と話していたんだろう?
この状況はどうなんでしょう?同じバーインデックスを使用しています。しかも、シンボルでの初回実行時のみ発生するようです。どちらか深いほうに。上のコードはバーのチェックだけかと思いきや...。
以下は良い指標ですhttps://www.mql5.com/ru/code/28364
必要なものはすべて組み込める !!!!
こんにちは。
以下の作業について、ご協力をお願いします。
MQL4 Expert Advisorからスクリプト(Python)を実行する必要があります。以下の方法でShellExecuteW()を使ってやろうとしています。
ファイルアクセスエラーが発生するのですが。スクリプトは実行されているが、コードが先に進まない。
スクリプトを実行する関数を教えていただけると幸いです。
もう一つの質問:スクリプトの実行を確認するにはどうすればよいのでしょうか?
こんにちは 2020.10.28_05:19:00 GMT+3です。LeManTrend_Indicator.mq5 のインジケータを4番目のバージョン .mq4 に翻訳しました。
こちらは適合しません
https://www.mql5.com/ru/code/9096
そして、これは合わない。
https://www.mql5.com/ru/code/9096
こっちの方が良さそうですね。