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
It's a persistent desire to deceive and deceive yourself :) .
Added: Have you tried displaying all the symbols and showing the "Time" column in the "Market Overview" window and discovering the bitcoin symbol that's trading on a non-stop basis? Also, such a basic check also helps:
Not a one-size-fits-all solution, but works for me
bool CanTrade()
{
bool res1=IsTradeAllowed(Symbol(), TimeCurrent());
bool res2=IsTradeAllowed(Symbol(), TimeCurrent()+4000); //с запасом,
if (!res1) return false; //сейчас торговать запрещено
if (res1 && res2) return true; //и сейчас и через час торговать можно
return false; //если зависло разрешение от TimeCurrent, то через час (или с запасом в несколько минут) покажет фалсе.
// Но наверняка есть ситуации когда реально сейчас можно торговать а через час нельзя - тогда неправильный ответ :(
}
But surely there are situations where you can really trade now and not in an hour
Of course it does - every time an hour before market close ))))
I disagree. The last date frozen on the screen is Friday 21:59. If I set shift at 3600 sec - the second parameter IsTradeAllowed(Symbol(), TimeCurrent()+3600 returns trude. I added some additional seconds to make it work. Well, if it is Friday at 21:50, everything should work.
To be honest, I didn't check it, I just checked connection to broker Reconnector (found it somewhere on forum) which always reconnected at weekends. So it's not significant for me.
bool MarketOpen(string Symbl)
{
if(IsTradeAllowed(Symbl,TimeCurrent()+1)==false)return(false); //рынок закрыт
return(true);
}
bool MarketOpen(string Symbl)
{
if(IsTradeAllowed(Symbl,TimeCurrent()+1)==false)return(false); //рынок закрыт
return(true);
}
It varies, so this check does not guarantee anything.
So trading by experts is forbidden, but the market is open.
Now, Monday, the market is open and the experts are banned by the office:
On the contrary, it happens that in some other offices on weekends, when the market is closed, these checks indicate that the market is open and experts have been given permission to trade.
yesterday.
so far it's working,
This one doesn't:
Forum on trading, automated trading systems and trading strategy testing
How do I know there is no trading on weekends?
Renat Akhtyamov, 2018.02.11 05:27
THANK YOU!
For MT4.
bool IsSessionOpen(string smb)
{
//MqlDateTime dt; datetime tc=TimeTradeServer(dt);
datetime tc= TimeCurrent();
// проверяем время торгов по инструменту
datetime t=(datetime)SymbolInfoInteger(smb, SYMBOL_EXPIRATION_TIME);
if (tc>t && t>0) return(false);
t=(datetime)SymbolInfoInteger(smb, SYMBOL_START_TIME);
if (tc<t && t>0) return(false);
// проверяем сессии инструмента
datetime ds=tc/(60*60*24); ds*=(60*60*24); // начало сегодня
datetime sec=tc-ds; // число секунд от начала дня
bool b=false;
for (int l=0; l<10; l++) // подразумеваем, что админ сделал не более 10 сессий в сутки
{
datetime fs, ts;
if (!SymbolInfoSessionTrade(smb, TimeDayOfWeek(TimeCurrent()), l, fs, ts)) break; // данные сессии
if (sec>=fs && sec<=ts) return(true);
}
return(false);
}
there's something about the 5p function that doesn't work:
(I wonder why ???)
https://www.mql5.com/ru/docs/standardlibrary/tradeclasses/cterminalinfo/cterminalinfoistradeallowed