Errori, bug, domande - pagina 1802
Ti stai perdendo delle opportunità di trading:
- App di trading gratuite
- Oltre 8.000 segnali per il copy trading
- Notizie economiche per esplorare i mercati finanziari
Registrazione
Accedi
Accetti la politica del sito e le condizioni d’uso
Se non hai un account, registrati
Stai suggerendo di farlo ad ogni spunta?
Sostengo la sincronizzazione ad ogni attivazione di OnBookEvent() :(
Non c'è dubbio, la questione è che oltre a questo, si suggerisce di chiamare CopyRates().... ogni volta. Questo mi sembra un capriccio...
:)
{
if(symbol == Symbol())
{
GetBars(Symbol(), time_frame);
}
}
Questo è il modo in cui mi è stato insegnato a SD
:)
{
if(symbol == Symbol())
{
GetBars(Symbol(), time_frame);
}
}
Se vuoi dire o mostrare qualcosa, per favore mostralo correttamente... Non voglio indovinare quale funzione avete qui e cosa fa.
Aggiunto:
Mi hai insegnato? E non ha dato un'attuazione?
Se vuoi dire o mostrare qualcosa, per favore mostralo correttamente... Non voglio indovinare quale funzione avete qui e cosa fa.
Aggiunto:
Mi hai insegnato? E non ha dato un'attuazione?
Cosa è normale?
Hanno detto che in due minuti i dati vengono scaricati e per mantenere la sincronizzazione
mi hanno detto di chiamare Bars.
//| 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);
}
Qui c'è
// 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);
}
Chiamando GetBars, stiamo facendo il backup della sincronizzazione o cercando di recuperare i dati
Cosa è normale?
Hanno detto che dopo due minuti i dati vengono scaricati e per mantenerli sincronizzati
hanno detto di chiamare Bars.
//| 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);
}
Non sono queste le analogie:
if(bool(SeriesInfoInteger(symbol, period, SERIES_SYNCHRONIZED)))
Sì, mi sembrava che Bars() restituisse 0 se non c'è sincronizzazione... Dovrò fare un test...
Sta suggerendo che questo dovrebbe essere fatto su ogni zecca?
Finché il simbolo è selezionato nella panoramica del mercato e la cronologia per il simbolo è tenuta dall'Expert Advisor, allora è mantenuta in sincronia. Il mantenimento da parte dell'Expert Advisor significa che è necessario accedere a questa storia almeno una volta ogni 2 minuti, per esempio copiando una barra. Se la storia è sincronizzata, non si spende tempo per copiare una barra - solo alcuni cicli del processore. Oppure, come è stato appena detto qui, chiedere il numero di barre, anche alcuni cicli di clock
Perché? Una singola azione è sufficiente.
Finché il simbolo è selezionato nella revisione del mercato e la cronologia sul simbolo è tenuta dall'Expert Advisor, è mantenuta in sincronia. La tenuta di Expert Advisor significa che è necessario accedere a questa storia almeno una volta ogni 2 minuti, per esempio copiando una barra. Se la cronologia è sincronizzata, allora non si spende tempo per copiare una barra - solo alcuni clock del processore.
Gli indicatori includono un intervallo di 2 minuti?
Sì, e controllando il fatto della sincronizzazione si terrà anche la sincronizzazione?
Gli indicatori includono un intervallo di 2 minuti?
Sì, il controllo della sincronizzazione terrà anche la sincronizzazione?
La sincronizzazione non si tiene controllando il fatto della sincronizzazione.