
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
By the way, it's strange that you call Sleep() from an indicator, because it is prohibited:
The Sleep() function cannot be called from custom indicators, as indicators are executed in the interface thread and must not slow it down. The function has built-in check for status of the expert's stop flag every 0.1 seconds.
By the way, it is strange that you call Sleep() from the indicator, as it is forbidden:
Alexei!
Quite a liquid instrument :)
It's not about instrument (liquidity), it's about delay, which can occur in ANY instrument.
I've been actively trading with EAs for almost 4 years now.
I don't have any pauses in any of my EAs (except pausing to wait for data to be downloaded from server in INDICATORS),
If you do pause, it's a sure sign that your EA's algorithm isn't working properly :(
I don't know what Sleep() is at all
Then it's strange that you and I are discussing pauses now...
Not in the sense of what Sleep() does, but in the sense of using it in my code.
How do you implement a pause in your indicator?
// Custom indicator Check timer function |
//+------------------------------------------------------------------+
bool CheckTimer(const uint start_value, const uint per_value)
{
uint end_value = GetTickCount();
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 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))
{
// Print( "LoadServerData: Первая дата на сервере есть. Пробуем получить локальные данные..." );
return(GetLocalData(a_symbol, period));
}
}
else
{
uint start_tick = GetTickCount();
//---
while(!CheckTimer(start_tick, 10))
{
fail_cnt--;
fail_cnt++;
}
}
fail_cnt++;
}
// Print( "LoadServerData: Первой даты на сервере нет!" );
return(0);
}
This is an old example.
As GetTickCount error is rather high (up to 16 ms), now I use GetMicrosecondCount().
In principle I do so, but in Forts the order is often accepted successfully...but on the next tick there is no position yet...
This is where the additional opening may slip .... partially solve the problem this way, if the order is accepted, I increase the int variable, and after the increase the conditions for opening are slightly different, so there is no new opening, but.... if the order is not accepted the variable is not increased, but here is the tricky part... I misjudged the state and additional orders started to appear.
Alexei!
Quite a liquid instrument :)
It's not about instrument (liquidity), it's about delay, which can occur in ANY instrument.
I've been actively trading with EAs for almost 4 years now.
I don't have any pauses in any of my EAs (except pausing to wait for data to be downloaded from server in INDICATORS),
If you do pause, it's a sure sign that your EA's algorithm isn't working properly :(
I too have been trading for quite a long time and only with the help of EAs. But mostly on MT4. I've been trading on MT5 only with Expert Advisors using Limits and there were no issues. If I'm a scalper or a pipsder, I do not like pauses in Expert Advisors, moreover I just miss an entry.