Yevhenii Levchenko: How to set a time filter (by hours) for EA trading? Will the following option work:
YOU google (time limitation of the EA - for example) - there may be special features, e.g. bidding from 22:00 hr to 04:00 hr. In Kim I.V.'s fonts Subject: Only useful fonts from Kim - have a look.
Here's an option:
externint HourStart=2;
// время начала работы советника в часах по времени терминала - может быть от 0 до 23externint HourEnd=22;
// время окончания работы советника в часах по времени терминала// пример - советник начинает работать в 2 часа 0 минут, заканчивает работу в 22, то есть в 22 часа и после советник не выставляет новых ордеров и ждет рабочего времени - 2 часаexternbool Use_Time=false;
...
//+------------------------------------------------------------------+//| expert start function |//+------------------------------------------------------------------+int start()
{
bool time_trade=false;
if(Use_Time==false) {time_trade=true;}
if(Use_Time==true && Hour()>=HourStart && Hour()<HourEnd) {time_trade=true;}
...
YOU google it - there may be special features, e.g. bidding from 22:00 hrs to 04:00 hrs. In Kim's f.i.v. Topic: Only useful f.i.v.'s from Kim - have a look.
No, Symbol() is an old way to get symbol name, the latest builds for MQL4 - MQL5 compatibility have added _Symbol
If you write code from scratch, use _Symbol, if you want to port the code to MQL5, you'll have less to edit it.
The difference is different. _Symbol is a predefined variable and Symbol() is a function.
Both work there and there. Everything is exactly the same. But once upon a time, one of the developers (I don't remember which one) said that it was preferable to use a function.
The difference is different. _Symbol is a predefined variable and Symbol() is a function.
Both work both ways. Everything is absolutely identical. But some time ago one of the developers (can't remember who exactly) said that it was preferable to use a function.
I think the best way to use it, I looked through the help, there is no definite recommendation from the developers
In practice, in some libraries the developers override Symbol() in class methods, in MQL5 I also overrode Symbol() method for custom TF in my class .... If it's convenient, I use it that way, I don't see any offence by the book axioms ))))
SZZ: I think it's already a religion... iClose() function should not be used - "it's a fake!" (С)
then here's a new trend _Symbol is worse than Symbol() ...measured the speed just in case, no difference at all, same work
I think you should use whatever is more convenient. I looked through the reference, there are no definite recommendations from the developers
In practice, in some libraries the developers override Symbol() in class methods, I also overrode Symbol() method for custom TF in MQL5 .... If it's convenient, I use it that way, I don't see any offence by the book axioms ))))
SZZ: I think this is a religion... iClose() function should not be used - "it's a fake!" (С)
then here's a new trend _Symbol is worse than Symbol() ...measured the speed just in case, no difference at all, same work
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
How to set a time filter (by hours) for EA trading? Will the following option work:
YOU google (time limitation of the EA - for example) - there may be special features, e.g. bidding from 22:00 hr to 04:00 hr. In Kim I.V.'s fonts Subject: Only useful fonts from Kim - have a look.
Here's an option:
YOU google it - there may be special features, e.g. bidding from 22:00 hrs to 04:00 hrs. In Kim's f.i.v. Topic: Only useful f.i.v.'s from Kim - have a look.
Here is an option:
Wow what a cool theme there ! Thank you!
And what I've done won't work?Wow what a cool theme there ! Thank you!
And what I've done won't work?Yeah dunno - get it ready and use it, figure out what's right. Bicycles have all been invented, IMHO.
How do I set the time filter (by hours) for EA trading? Would the following option work:
We discussed this some time ago, here's a topic, my examples all work, I use it, everything works in MT4https://www.mql5.com/ru/forum/317351
What are the specifics of using Symbol() and _Symbol ?
Would the following code work correctly to check the presence of orders for the current symbol ?
No, Symbol() is an old way to get symbol name, the latest builds for MQL4 - MQL5 compatibility have added _Symbol
If you write code from scratch, use _Symbol, if you want to port the code to MQL5, you'll have less to edit it.
We discussed this some time ago, here's a topic, my examples all work, I use it, everything works in MT4https://www.mql5.com/ru/forum/317351
No, Symbol() is an old way to get symbol name, the latest builds for MQL4 - MQL5 compatibility have added _Symbol
If you write code from scratch, use _Symbol, if you want to port the code to MQL5, you'll have less to edit it.
The code, of course, is much bigger than what I tried to prescribe... :) I'll have to sit and figure it out...
We discussed this some time ago, here's a topic, my examples all work, I use it, everything works in MT4https://www.mql5.com/ru/forum/317351
No, Symbol() is an old way to get symbol name, the latest builds for MQL4 - MQL5 compatibility have added _Symbol
If you write code from scratch, use _Symbol, if you want to port the code to MQL5, you'll have less to edit it.
The difference is different. _Symbol is a predefined variable and Symbol() is a function.
Both work there and there. Everything is exactly the same. But once upon a time, one of the developers (I don't remember which one) said that it was preferable to use a function.
Forum on trading, automated trading systems and testing trading strategies
What is different between Symbol() and _Symbol
fxsaber, 2019.07.07 14:47
The difference is different. _Symbol is a predefined variable and Symbol() is a function.
Both work both ways. Everything is absolutely identical. But some time ago one of the developers (can't remember who exactly) said that it was preferable to use a function.
I think the best way to use it, I looked through the help, there is no definite recommendation from the developers
In practice, in some libraries the developers override Symbol() in class methods, in MQL5 I also overrode Symbol() method for custom TF in my class .... If it's convenient, I use it that way, I don't see any offence by the book axioms ))))
SZZ: I think it's already a religion... iClose() function should not be used - "it's a fake!" (С)
then here's a new trend _Symbol is worse than Symbol() ...measured the speed just in case, no difference at all, same work
2019.08.09 00:54:20.631 tst EURUSD,H1: Symbol(): loops=1000000000 ms=66203
2019.08.09 00:53:14.432 tst EURUSD,H1: test 6:
2019.08.09 00:53:14.432 tst EURUSD,H1: _Symbol: loops=1000000000 ms=65515
2019.08.09 00:52:08.921 tst EURUSD,H1: test 5:
2019.08.09 00:52:08.921 tst EURUSD,H1: Symbol(): loops=1000000000 ms=65610
2019.08.09 00:51:03.301 tst EURUSD,H1: test 4:
2019.08.09 00:51:03.301 tst EURUSD,H1: _Symbol: loops=1000000000 ms=65890
2019.08.09 00:49:57.418 tst EURUSD,H1: test 3:
2019.08.09 00:49:57.418 tst EURUSD,H1: Symbol(): loops=1000000000 ms=65563
2019.08.09 00:48:51.850 tst EURUSD,H1: test 2:
2019.08.09 00:48:51.850 tst EURUSD,H1: _Symbol: loops=1000000000 ms=65750
2019.08.09 00:47:46.105 tst EURUSD,H1: test 1:
I think you should use whatever is more convenient. I looked through the reference, there are no definite recommendations from the developers
In practice, in some libraries the developers override Symbol() in class methods, I also overrode Symbol() method for custom TF in MQL5 .... If it's convenient, I use it that way, I don't see any offence by the book axioms ))))
SZZ: I think this is a religion... iClose() function should not be used - "it's a fake!" (С)
then here's a new trend _Symbol is worse than Symbol() ...measured the speed just in case, no difference at all, same work
2019.08.09 00:54:20.631 tst EURUSD,H1: Symbol(): loops=1000000000 ms=66203
2019.08.09 00:53:14.432 tst EURUSD,H1: test 6:
2019.08.09 00:53:14.432 tst EURUSD,H1: _Symbol: loops=1000000000 ms=65515
2019.08.09 00:52:08.921 tst EURUSD,H1: test 5:
2019.08.09 00:52:08.921 tst EURUSD,H1: Symbol(): loops=1000000000 ms=65610
2019.08.09 00:51:03.301 tst EURUSD,H1: test 4:
2019.08.09 00:51:03.301 tst EURUSD,H1: _Symbol: loops=1000000000 ms=65890
2019.08.09 00:49:57.418 tst EURUSD,H1: test 3:
2019.08.09 00:49:57.418 tst EURUSD,H1: Symbol(): loops=1000000000 ms=65563
2019.08.09 00:48:51.850 tst EURUSD,H1: test 2:
2019.08.09 00:48:51.850 tst EURUSD,H1: _Symbol: loops=1000000000 ms=65750
2019.08.09 00:47:46.105 tst EURUSD,H1: test 1:
As the saying goes - what you buy, you sell for. The recommendation was not in the documentation, but from word of mouth on the forum.
Why is the last line without a slash, and is it possible to return a value from a macro