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
I'm writing a multi-currency Expert Advisor where in the input parameters I set the instrument name, such as string Symbol0="EURUSD". If I write the wrong name, the trade does not go. My question is: Does such a function exist, that would compare instrument names with instruments offered by the broker?
The question is what you want to see in the output. Basically, any standard function that uses a symbolic instrument name as one of its parameters, "compares" the user-specified name with the broker's instrument names. And there is even an ERR_MARKET_UNKNOWN_SYMBOL (4301) error for such functions.
I am trying to make a tick collection indicator for further processing and visualisation. MT5 AlpariUK Version 5.0 Build 756
The test indicator prints current BID, ASK, LAST, VOLUME, tick_volume values when processing onCalculate.
Result:
2013.03.03 19:45:59 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:46:03 Bid=93.680 Ask=93.689 Price=93.680000 Volume=1000000 Tick volume=5
2013.03.03 19:45:59 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:46:03 Bid=93.680 Ask=93.689 Price=93.680000 Volume=1000000 Tick volume=4
2013.03.03 03 19:45:59 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:46:03 Bid=93.681 Ask=93.691 Price=93.68100000 Volume=3000000 Tick volume=4
2013.03.03.03 19:45:59 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:46:03 Bid=93.681 Ask=93.691 Price=93.68100000 Volume=3000000 Tick volume=4
2013.03.03 19:45:58 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:46:02 Bid=93.682 Ask=93.691 Price=93.68200000 Volume=2000000 Tick volume=3
2013.03.03 19:45:58 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:46:02 Bid=93.682 Ask=93.691 Price=93.68200000 Volume=2000000 Tick volume=3
201303.03.03 19:45:57 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:46:01 Bid=93.683 Ask=93.693 Price=93.68300000 Volume=1000000 Tick volume=2
2013.03.03 19:45:57 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:46:01 Bid=93.683 Ask=93.693 Price=93.68300000 Volume=1000000 Tick volume=1
2013.03.03 03 19:45:56 PM TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:46:00 Bid=93.689 Ask=93.696 Price=93.68900000 Volume=570000 Tick volume=1
2013.03.03.03 19:45:56 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:46:00 Bid=93.689 Ask=93.696 Price=93.68900000 Volume=570000 Tick volume=1
2013.03.03 19:45:55 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:59 Bid=93.685 Ask=93.695 Price=93.68500000 Volume=1800000 Tick volume=53
2013.03.03 19:45:54 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:58 Bid=93.685 Ask=93.695 Price=93.68500000 Volume=1700000 Tick volume=52
201303.03.03 19:45:54 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:58 Bid=93.685 Ask=93.695 Price=93.68500000 Volume=1500000 Tick volume=51
2013.03.03 19:45:54 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:58 Bid=93.685 Ask=93.695 Price=93.68500000 Volume=1500000 Tick volume=51
2013.03.03 19:45:53 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:57 Bid=93.685 Ask=93.693 Price=93.68500000 Volume=500000 Tick volume=50
201303.03.03 19:45:52 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:56 Bid=93.685 Ask=93.693 Price=93.68500000 Volume=400000 Tick volume=49
2013.03.03 19:45:52 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:56 Bid=93.685 Ask=93.693 Price=93.68500000 Volume=200000 Tick volume=48
2013.03.03 19:45:52 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:56 Bid=93.685 Ask=93.693 Price=93.68500000 Volume=200000 Tick volume=48
201303.03.03 19:45:51 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:55 Bid=93.685 Ask=93.691 Price=93.68500000 Volume=200000 Tick volume=47
2013.03.03 19:45:51 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:55 Bid=93.685 Ask=93.691 Price=93.68500000 Volume=1000000 Tick volume=46
2013.03.03 19:45:51 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:55 Bid=93.685 Ask=93.691 Price=93.68500000 Volume=1000000 Tick volume=46
201303.03.03 19:45:50 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:54 Bid=93.680 Ask=93.691 Price=93.68000000 Volume=1000000 Tick volume=45
2013.03.03 19:45:50 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:54 Bid=93.680 Ask=93.691 Price=93.680000 Volume=1000000 Tick volume=45
2013.0303 19:45:48 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:45:52 Bid=93.682 Ask=93.691 Price=93.68200000 Volume=1000000 Tick volume=44
It looks like onCalculate is triggered twice per tick most of the time, and tick_volume has nothing to do with tick volume. It is reset to 1 when you switch to a new period. The same value can be repeated 1, 2, 3 times.
To check, ran EA which prints ticks and its own indicator at the same time.
Result:
2013.03.03 19:51:56 Ticks (USDJPY,M1) 2013.03.03 19:51:56 93.684 93.677
2013.03.03.03 19:51:56 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:52:00 Bid=93.677 Ask=93.684 Price=93.67700000 Volume=1000000 Tick volume=2
2013.0303 19:51:56 PM TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:52:00 Bid=93.677 Ask=93.684 Price=93.67700000 Volume=1000000 Tick volume=2
2013.03.03 19:51:56 Ticks (USDJPY,M1) 2013.03.03.03 19:51:56 93.683 93.674
2013.03.03 19:51:56 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:52:00 Bid=93.674 Ask=93.683 Price=93.67400000 Volume=3000000 Tick volume=1
2013.03.03 19:51:56 TestTickCollector (USDJPY,M1) Server Time=201303.04 02:52:00 Bid=93.674 Ask=93.683 Price=93.67400000 Volume=3000000 Tick volume=1
201303.03.03 19:51:55 Ticks (USDJPY,M1) 2013.03.03 19:51:55 93. 682 93.674
2013.03.03 19:51:55 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:59 Bid=93.674 Ask=93.682 Price=93.67400000 Volume=3000000 Tick volume=37
2013.03.03 19:51:55 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:59 Bid=93.674 Ask=93.682 Price=93.67400000 Volume=3000000 Tick volume=37
2013.03.03 19:51:51:51 Ticks (USDJPY,M1) 2013.03.03.03 19:51:51 93.680 93.670
2013.03.03 19:51:51 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:55 Bid=93.670 Ask=93.680 Price=93.67000000 Volume=1000000 Tick volume=36
2013.03.03 19:51:51 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:55 Bid=93.670 Ask=93.680 Price=93.67000000 Volume=1000000 Tick volume=36
2013.03.03 19:51:50 Ticks (USDJPY,M1) 2013.03.03 2013 19:51:50 93.678 93.669
2013.03.03 19:51:50 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:54 Bid=93.669 Ask=93.678 Price=93.66900000 Volume=3500000 Tick volume=35
201303.03.03 19:51:49 Ticks (USDJPY,M1) 2013.03.03 19:51:49 93. 678 93.669
2013.03.03 19:51:49 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:53 Bid=93.669 Ask=93.678 Price=93.66900000 Volume=3000000 Tick volume=34
2013.03.03 19:51:49 PM TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:53 Bid=93.669 Ask=93.678 Price=93.66900000 Volume=3000000 Tick volume=34
2013.03.03 19:51:46 Ticks (USDJPY,M1) 2013.03.03.03 19:51:46 93.680 93.672
2013.03.03 19:51:46 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:50 Bid=93.672 Ask=93.680 Price=93.67200000 Volume=1000000 Tick volume=33
2013.03.03 19:51:46 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:50 Bid=93.672 Ask=93.680 Price=93.67200000 Volume=1000000 Tick volume=33
201303.03.03 19:51:44 Ticks (USDJPY,M1) 2013.03.03 19:51:44 93.681 93.672
2013.03.03 19:51:44 19:51:44 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:48 Bid=93.672 Ask=93.681 Price=93.67200000 Volume=1000000 Tick volume=32
2013.03 03.03 19:51:44 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:48 Bid=93.672 Ask=93.681 Price=93.67200000 Volume=1000000 Tick volume=32
2013.03.03 19:51:44 Ticks (USDJPY,M1) 2013.03.03 2013 19:51:44 93.683 93.673
2013.03.03 19:51:44 TestTickCollector (USDJPY,M1) Server Time=2013.03.03.04 02:51:48 Bid=93.673 Ask=93.683 Price=93.67300000 Volume=1000000 Tick volume=31
2013.03.03 19:51:44 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:48 Bid=93.673 Ask=93.683 Price=93.67300000 Volume=1000000 Tick volume=30
2013.03.03.03 19:51:42 Ticks (USDJPY,M1) 2013.03.03 19:51:42 93.683 93.674
2013.03.0303 19:51:42 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:46 Bid=93.674 Ask=93.683 Price=93.67400000 Volume=3000000 Tick volume=30
2013.03.03 19:51:42 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:46 Bid=93.674 Ask=93.683 Price=93.67400000 Volume=3000000 Tick volume=30
2013.03.03 19:51:41 Ticks (USDJPY,M1) 2013.03.03.03 19:51:41 93.683 93.673
2013.03.03 19:51:41 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:45 Bid=93.673 Ask=93.683 Price=93.67300000 Volume=1000000 Tick volume=29
201303.03.03 19:51:41 GMT TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:45 Bid=93.673 Ask=93.683 Price=93.67300000 Volume=1000000 Tick volume=29
2013.03.0303 03 19:51:40 Ticks (USDJPY,M1) 2013.03.03 19:51:40 93.682 93.673
2013.03.03 19:51:40 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:44 Bid=93.673 Ask=93.682 Price=93.67300000 Volume=1000000 Tick volume=28
2013.03.03 19:51:40 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:44 Bid=93.673 Ask=93.682 Price=93.67300000 Volume=1000000 Tick volume=28
2013.03.03 19:51:39 Ticks (USDJPY,M1) 2013.03.03 2013 19:51:39 93.681 93.671
2013.03.03 19:51:39 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:43 Bid=93.671 Ask=93.681 Price=93.67100000 Volume=40000 Tick volume=27
201303.03.03 19:51:38 Ticks (USDJPY,M1) 2013.03.03 19:51:38 93. 681 93.671
2013.03.03 19:51:38 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:42 Bid=93.671 Ask=93.681 Price=93.67100000 Volume=6000000 Tick volume=26
2013.03.03 19:51:38 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:42 Bid=93.671 Ask=93.681 Price=93.67100000 Volume=60000 Tick volume=26
2013.03.03 19:51:37 Ticks (USDJPY,M1) 2013.03.03.03 19:51:37 93.682 93.674
2013.03.03 19:51:37 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:41 Bid=93.674 Ask=93.682 Price=93.67400000 Volume=1000000 Tick volume=25
2013.03.03 19:51:37 TestTickCollector (USDJPY,M1) Server Time=2013.03.04 02:51:41 Bid=93.674 Ask=93.682 Price=93.67400000 Volume=1000000 Tick volume=24
Question: why is the tick duplicated and how do I get rid of it?
If onCalculate is triggered not only by a price change, but also for some other reasons, then how can we determine the reason for the switch to opCalculate ? And where are all the reasons for onCalculate triggering?
What am I doing wrong with the Tick volume ?
Am I missing something?
One more question - the time on my computer is lagging quite a bit. The difference in two days was 4 seconds. In what direction to look for a solution?
Thank you all.
Another question for the esteemed public:
In the documentation on https://www.mql5.com/ru/docs/constants/environment_state/marketinfoconstants#enum_symbol_info_integer
states:
SYMBOL_BID Bid - best offer to sell
SYMBOL_ASK Ask - best buy offer
The way I see it, Bid is the bestbuy offer and Ask is the best sell offer.
Here is what ServiceDesk repliedThat means
SYMBOL_BID Bid - the best offer to sell (the best price you can sell at)
SYMBOL_ASK Ask - best buy offer (the best price you can get right now)
Here's a discussion: who's right?
Another question for the esteemed public:
In the documentation on https://www.mql5.com/ru/docs/constants/environment_state/marketinfoconstants#enum_symbol_info_integer
states:
SYMBOL_BID Bid - best offer to sell
SYMBOL_ASK Ask - best buy offer
The way I see it, Bid is the bestbuy offer and Ask is the best sell offer.
Here is what ServiceDesk has answeredMZen
SYMBOL_BID Bid - the best offer to sell (the best price which you can sell at)
SYMBOL_ASK Ask - the best buy offer (the best price you can get right now)
I'm debating: who's right?
Play on words - both situations have a buyer, both situations have a seller, depending on which position to look at
Ahhhh, got it!
When I ask "Buy from me" it's an offer to buy!
And when I say 'Sell to me', it's an offer to sell!
LOL!
I am beginning to learn OOP. Question for experts - is it possible to put the class at the end of the Expert Advisor code (as well as functions),
and not to connect the class to the code as:
#include <Trade\Trade.mqh>
I am beginning to learn OOP. Question for experts - is it possible to put the class at the end of the Expert Advisor code (as well as functions),
and not connect the class to the code as: