エラー、バグ、質問 - ページ 1802 1...179517961797179817991800180118021803180418051806180718081809...3185 新しいコメント prostotrader 2017.02.14 12:26 #18011 Alexey Kozitsyn: 毎回のティックで行うことを推奨しているのでしょうか? OnBookEvent()のすべてのトリガーで同期をサポートしています :( 削除済み 2017.02.14 12:27 #18012 prostotrader: OnBookEvent()の各トリガーでの同期をサポートしています :( ここでは質問はありません。問題は、これに加えて、CopyRates() を毎回呼び出すことが提案されていることです。これは何かの癇癪のような気がするのですが...。 prostotrader 2017.02.14 12:31 #18013 Alexey Kozitsyn: ここでは質問はありません。問題は、これに加えて、CopyRates()...関数を 毎回呼び出すことが提案されていることです。これは癇癪持ちにしか見えないが...。:)void OnBookEvent(const string &symbol){ if(symbol == Symbol()) { GetBars(Symbol(), time_frame); } }SDではこのように教わりました 削除済み 2017.02.14 12:33 #18014 prostotrader::)void OnBookEvent(const string &symbol){ if(symbol == Symbol()) { GetBars(Symbol(), time_frame); } }言いたいこと、見せたいことがあるなら、きちんと見せてほしい...。ここにある機能が何なのか、何をするものなのか、推測するのはやめましょう。追加されました。教えてくれたんですか?そして、実装はしなかったのですか? prostotrader 2017.02.14 12:37 #18015 Alexey Kozitsyn:言いたいこと、見せたいことがあるなら、きちんと見せてほしい...。ここにある機能が何なのか、何をするものなのか、推測するのはやめましょう。追加されました。教えてくれたんですか?そして、実装はしなかったのですか?普通ってなんだろう?2分でデータがアンロードされるとのことで、同期を維持するためにバーズに 電話するように言われました。//+------------------------------------------------------------------+//| Custom indicator Get bars function |//+------------------------------------------------------------------+int GetBars(string symbol, ENUM_TIMEFRAMES period){ if(!IsStopped()) { if(SymbolIsSynchronized(symbol)) { if(bool(SeriesInfoInteger(symbol, period, SERIES_SYNCHRONIZED))) { int a_bars = Bars(symbol, period); if(a_bars > 0) { return(a_bars); } else { return(GetLocalData(symbol, period)); } } else { return(GetLocalData(symbol, period)); } } else { return(LoadServerData(symbol, period)); } } return(0);} 完全な実装を探します。 prostotrader 2017.02.14 12:41 #18016 以下は//+------------------------------------------------------------------+// Custom indicator Check timer function |//+------------------------------------------------------------------+bool CheckTimer(const ulong start_value, const ulong per_value){ ulong end_value = GetMicrosecondCount(); if(end_value < start_value) { if((start_value - end_value) >= per_value) return(true); } else { if((end_value - start_value) >= per_value) return(true); } return(false);}//+------------------------------------------------------------------+//| Custom indicator Get local data function |//+------------------------------------------------------------------+int GetLocalData(const string a_symbol, ENUM_TIMEFRAMES a_period){ long first_date; int fail_cnt = 0; while((fail_cnt < 3) && !IsStopped()) { first_date = long( SeriesInfoInteger(a_symbol, PERIOD_M1, SERIES_TERMINAL_FIRSTDATE)); if(first_date > 0) { int f_cnt = 0; datetime times[1]; long a_bars = 0; while((f_cnt < 5) && !IsStopped()) { if(bool(SeriesInfoInteger(a_symbol, PERIOD_M1, SERIES_BARS_COUNT, a_bars))) { if ( a_bars > 0 ) { if( bool(SeriesInfoInteger(a_symbol, a_period, SERIES_BARS_COUNT, a_bars))) if(a_bars > 0) return(int(a_bars)); } } else {//--- force timeseries build CopyTime(a_symbol, a_period, 0, 1, times); ulong start_tick = GetMicrosecondCount(); while(!CheckTimer(start_tick, 5000)) { f_cnt--; f_cnt++; } } f_cnt++; } } else { ulong start_tick = GetMicrosecondCount(); while(!CheckTimer(start_tick, 5000)) { fail_cnt--; fail_cnt++; } }//--- fail_cnt++; } return(0);}//+------------------------------------------------------------------+//| Custom indicator Get server data function |//+------------------------------------------------------------------+int LoadServerData(const string a_symbol, ENUM_TIMEFRAMES period){ int fail_cnt = 0; while((fail_cnt < 5) && !IsStopped()) { long first_date = long(SeriesInfoInteger(a_symbol, PERIOD_M1, SERIES_SERVER_FIRSTDATE)); if(first_date > 0) { if(SymbolIsSynchronized(a_symbol)) { return(GetLocalData(a_symbol, period)); } } else { ulong start_tick = GetMicrosecondCount(); while(!CheckTimer(start_tick, 20000)) { fail_cnt--; fail_cnt++; } } fail_cnt++; } return(0); }//+------------------------------------------------------------------+//| Custom indicator Get bars function |//+------------------------------------------------------------------+int GetBars(string symbol, ENUM_TIMEFRAMES period){ if(!IsStopped()) { if(SymbolIsSynchronized(symbol)) { if(bool(SeriesInfoInteger(symbol, period, SERIES_SYNCHRONIZED))) { int a_bars = Bars(symbol, period); if(a_bars > 0) { return(a_bars); } else { return(GetLocalData(symbol, period)); } } else { return(GetLocalData(symbol, period)); } } else { return(LoadServerData(symbol, period)); } } return(0);} GetBarsを呼び出すことで、同期のバックアップやデータの取得を試みている Errors, bugs, questions 成行注文を正しく発注するにはどうしたらよいですか? How do I open 削除済み 2017.02.14 12:41 #18017 prostotrader:普通ってなんだろう?2分後にデータがアンロードされるとのことで、同期をとるためにバーズに 電話するように言われた。//+------------------------------------------------------------------+//| Custom indicator Get bars function |//+------------------------------------------------------------------+int GetBars(string symbol, ENUM_TIMEFRAMES period){ if(!IsStopped()) { if(SymbolIsSynchronized(symbol)) { if(bool(SeriesInfoInteger(symbol, period, SERIES_SYNCHRONIZED))) { int a_bars = Bars(symbol, period); if(a_bars > 0) { return(a_bars); } else { return(GetLocalData(symbol, period)); } } else { return(GetLocalData(symbol, period)); } } else { return(LoadServerData(symbol, period)); } } return(0);}これらはアナログではないでしょうか。if(SymbolIsSynchronized(symbol))if(bool(SeriesInfoInteger(symbol, period, SERIES_SYNCHRONIZED)))そうですね、Bars()は同期が取れていない場合は0を返すような気がしました...。テストをしてみないと...。 Slava 2017.02.14 12:46 #18018 Alexey Kozitsyn: これをすべてのティックに行うべきだとおっしゃるのですか? なぜ?ワンアクションで十分です。 マーケット概観でシンボルを選択し、そのシンボルの履歴をExpert Advisorが保持している間、同期が保たれます。Expert Advisorによる保持は、1本のバーをコピーするなどして、少なくとも2分に一度はこの履歴にアクセスする必要があることを意味します。履歴が同期していれば、1本のバーをコピーするのにかかる時間はなく、わずか数プロセッササイクルで済みます。あるいは、今ここで言われたように、バーの 数を求め、また数クロックサイクル 削除済み 2017.02.14 12:47 #18019 Slawa: なぜ?ワンアクションで十分です。 マーケットレビューでシンボルが選択され、そのシンボルの履歴がExpert Advisorに保持されている限り、同期が保たれるのです。Expert Advisorの保有は、1本のバーをコピーするなどして、少なくとも2分に1回はこの履歴にアクセスする必要があることを意味します。履歴が同期していれば、1本のバーをコピーするために時間を費やすことはなく、数個のプロセッサクロックがあればよいのです。インジケーターには2分間隔が含まれていますか? はい、また、同期の事実を確認することで、同期も保持されるのでしょうか? Slava 2017.02.14 12:50 #18020 Alexey Kozitsyn:インジケーターには2分間隔が含まれていますか? はい、また、シンクロの事実を確認することで、シンクロも保持されるのでしょうか? また、指標にも適用されます。1分タイマーを作成し、興味のあるすべてのタイムスケールのバー 数を尋ねます。 同期の事実を確認することで、同期が保たれるわけではありません。 1...179517961797179817991800180118021803180418051806180718081809...3185 新しいコメント 取引の機会を逃しています。 無料取引アプリ 8千を超えるシグナルをコピー 金融ニュースで金融マーケットを探索 新規登録 ログイン スペースを含まないラテン文字 このメールにパスワードが送信されます エラーが発生しました Googleでログイン WebサイトポリシーおよびMQL5.COM利用規約に同意します。 新規登録 MQL5.com WebサイトへのログインにCookieの使用を許可します。 ログインするには、ブラウザで必要な設定を有効にしてください。 ログイン/パスワードをお忘れですか? Googleでログイン
毎回のティックで行うことを推奨しているのでしょうか?
OnBookEvent()の各トリガーでの同期をサポートしています :(
ここでは質問はありません。問題は、これに加えて、CopyRates()...関数を 毎回呼び出すことが提案されていることです。これは癇癪持ちにしか見えないが...。
:)
{
if(symbol == Symbol())
{
GetBars(Symbol(), time_frame);
}
}
SDではこのように教わりました
:)
{
if(symbol == Symbol())
{
GetBars(Symbol(), time_frame);
}
}
言いたいこと、見せたいことがあるなら、きちんと見せてほしい...。ここにある機能が何なのか、何をするものなのか、推測するのはやめましょう。
追加されました。
教えてくれたんですか?そして、実装はしなかったのですか?
言いたいこと、見せたいことがあるなら、きちんと見せてほしい...。ここにある機能が何なのか、何をするものなのか、推測するのはやめましょう。
追加されました。
教えてくれたんですか?そして、実装はしなかったのですか?
普通ってなんだろう?
2分でデータがアンロードされるとのことで、同期を維持するために
バーズに 電話するように言われました。
//| Custom indicator Get bars function |
//+------------------------------------------------------------------+
int GetBars(string symbol, ENUM_TIMEFRAMES period)
{
if(!IsStopped())
{
if(SymbolIsSynchronized(symbol))
{
if(bool(SeriesInfoInteger(symbol, period, SERIES_SYNCHRONIZED)))
{
int a_bars = Bars(symbol, period);
if(a_bars > 0)
{
return(a_bars);
}
else
{
return(GetLocalData(symbol, period));
}
}
else
{
return(GetLocalData(symbol, period));
}
}
else
{
return(LoadServerData(symbol, period));
}
}
return(0);
}
以下は
// Custom indicator Check timer function |
//+------------------------------------------------------------------+
bool CheckTimer(const ulong start_value, const ulong per_value)
{
ulong end_value = GetMicrosecondCount();
if(end_value < start_value)
{
if((start_value - end_value) >= per_value) return(true);
}
else
{
if((end_value - start_value) >= per_value) return(true);
}
return(false);
}
//+------------------------------------------------------------------+
//| Custom indicator Get local data function |
//+------------------------------------------------------------------+
int GetLocalData(const string a_symbol, ENUM_TIMEFRAMES a_period)
{
long first_date;
int fail_cnt = 0;
while((fail_cnt < 3) && !IsStopped())
{
first_date = long( SeriesInfoInteger(a_symbol, PERIOD_M1, SERIES_TERMINAL_FIRSTDATE));
if(first_date > 0)
{
int f_cnt = 0;
datetime times[1];
long a_bars = 0;
while((f_cnt < 5) && !IsStopped())
{
if(bool(SeriesInfoInteger(a_symbol, PERIOD_M1, SERIES_BARS_COUNT, a_bars)))
{
if ( a_bars > 0 )
{
if( bool(SeriesInfoInteger(a_symbol, a_period, SERIES_BARS_COUNT, a_bars)))
if(a_bars > 0) return(int(a_bars));
}
}
else
{
//--- force timeseries build
CopyTime(a_symbol, a_period, 0, 1, times);
ulong start_tick = GetMicrosecondCount();
while(!CheckTimer(start_tick, 5000))
{
f_cnt--;
f_cnt++;
}
}
f_cnt++;
}
}
else
{
ulong start_tick = GetMicrosecondCount();
while(!CheckTimer(start_tick, 5000))
{
fail_cnt--;
fail_cnt++;
}
}
//---
fail_cnt++;
}
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator Get server data function |
//+------------------------------------------------------------------+
int LoadServerData(const string a_symbol, ENUM_TIMEFRAMES period)
{
int fail_cnt = 0;
while((fail_cnt < 5) && !IsStopped())
{
long first_date = long(SeriesInfoInteger(a_symbol, PERIOD_M1, SERIES_SERVER_FIRSTDATE));
if(first_date > 0)
{
if(SymbolIsSynchronized(a_symbol))
{
return(GetLocalData(a_symbol, period));
}
}
else
{
ulong start_tick = GetMicrosecondCount();
while(!CheckTimer(start_tick, 20000))
{
fail_cnt--;
fail_cnt++;
}
}
fail_cnt++;
}
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator Get bars function |
//+------------------------------------------------------------------+
int GetBars(string symbol, ENUM_TIMEFRAMES period)
{
if(!IsStopped())
{
if(SymbolIsSynchronized(symbol))
{
if(bool(SeriesInfoInteger(symbol, period, SERIES_SYNCHRONIZED)))
{
int a_bars = Bars(symbol, period);
if(a_bars > 0)
{
return(a_bars);
}
else
{
return(GetLocalData(symbol, period));
}
}
else
{
return(GetLocalData(symbol, period));
}
}
else
{
return(LoadServerData(symbol, period));
}
}
return(0);
}
GetBarsを呼び出すことで、同期のバックアップやデータの取得を試みている
普通ってなんだろう?
2分後にデータがアンロードされるとのことで、同期をとるために
バーズに 電話するように言われた。
//| Custom indicator Get bars function |
//+------------------------------------------------------------------+
int GetBars(string symbol, ENUM_TIMEFRAMES period)
{
if(!IsStopped())
{
if(SymbolIsSynchronized(symbol))
{
if(bool(SeriesInfoInteger(symbol, period, SERIES_SYNCHRONIZED)))
{
int a_bars = Bars(symbol, period);
if(a_bars > 0)
{
return(a_bars);
}
else
{
return(GetLocalData(symbol, period));
}
}
else
{
return(GetLocalData(symbol, period));
}
}
else
{
return(LoadServerData(symbol, period));
}
}
return(0);
}
これらはアナログではないでしょうか。
if(bool(SeriesInfoInteger(symbol, period, SERIES_SYNCHRONIZED)))
そうですね、Bars()は同期が取れていない場合は0を返すような気がしました...。テストをしてみないと...。
これをすべてのティックに行うべきだとおっしゃるのですか?
マーケット概観でシンボルを選択し、そのシンボルの履歴をExpert Advisorが保持している間、同期が保たれます。Expert Advisorによる保持は、1本のバーをコピーするなどして、少なくとも2分に一度はこの履歴にアクセスする必要があることを意味します。履歴が同期していれば、1本のバーをコピーするのにかかる時間はなく、わずか数プロセッササイクルで済みます。あるいは、今ここで言われたように、バーの 数を求め、また数クロックサイクル
なぜ?ワンアクションで十分です。
マーケットレビューでシンボルが選択され、そのシンボルの履歴がExpert Advisorに保持されている限り、同期が保たれるのです。Expert Advisorの保有は、1本のバーをコピーするなどして、少なくとも2分に1回はこの履歴にアクセスする必要があることを意味します。履歴が同期していれば、1本のバーをコピーするために時間を費やすことはなく、数個のプロセッサクロックがあればよいのです。
インジケーターには2分間隔が含まれていますか?
はい、また、同期の事実を確認することで、同期も保持されるのでしょうか?
インジケーターには2分間隔が含まれていますか?
はい、また、シンクロの事実を確認することで、シンクロも保持されるのでしょうか?
同期の事実を確認することで、同期が保たれるわけではありません。