
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
This is GBPAUD H4 3.12.2018 whole day! And I did not skip to end this time.
May print function lose some reports when it has too much to print?
I guess another issue could be because ticks of these 3 instruments come out in different milliseconds so when we use start/OnTick function on GBPAUD, it just does the start function whenever GBPAUD tick comes out. And I guess your code might says to return all of those 3 pairs prices when non of them are 0. If so, it Does return whenever all ask/bid prices of all instruments come out at the same exact time.
Data looks fine...
You're right about the print function... I see many missing lines in my testing too. But when I print everything to file, nothing is missed out.
Here's some information about the code: the time of each GBPAUD tick will be used to get the most recent ticks of the other pairs (up to the same time), so it'll always return something, won't be zero.
I've decided to put the function into a class, which should be tidier. See attached. Place it in your expert folder, together with your EA. Feel free to modify it.
Following sample shows you one way of using it (highlighted lines are essential):
So the key really, is just this line: ticksInfo.getTick(<SYMBOL String>,<MqlTick Struct>). If it returns false, you'll have to check the journal for the error message.
Data looks fine...
You're right about the print function... I see many missing lines in my testing too. But when I print everything to file, nothing is missed out.
Here's some information about the code: the time of each GBPAUD tick will be used to get the most recent ticks of the other pairs (up to the same time), so it'll always return something, won't be zero.
I've decided to put the function into a class, which should be tidier. See attached. Place it in your expert folder, together with your EA. Feel free to modify it.
Following sample shows you one way of using it (highlighted lines are essential):
So the key really, is just this line: ticksInfo.getTick(<SYMBOL String>,<MqlTick Struct>). If it returns false, you'll have to check the journal for the error message.
Thank you for your help,
I've copied all these lines into every proper areas. But since I do not understand the code, please advise me how to put the Ask and Bid of SecondPair into Ask2,Bid2 and the same thing for ThirdPair.
Here is my global area:
And This part returns 2 errors while compiling. What should I do with them?:
'SecondPair' - constant expression required MyEA!.mq4
'ThirdPair' - constant expression required MyEA!.mq4
Thank you for your help,
I've copied all these lines into every proper areas. But since I do not understand the code, please advise me how to put the Ask and Bid of SecondPair into Ask2,Bid2 and the same thing for ThirdPair.
Here is my global area:
And This part returns 2 errors while compiling. What should I do with them?:
'SecondPair' - constant expression required MyEA!.mq4
'ThirdPair' - constant expression required MyEA!.mq4
Then declare your otherPairs the same way as allPairs. And in OnInit, do this:
And to assign values into Ask2, Bid2, Ask3, Bid3, do this in OnTick:
Then declare your otherPairs the same way as allPairs. And in OnInit, do this:
And to assign values into Ask2, Bid2, Ask3, Bid3, do this in OnTick:
It gives me 00 again :(
My global area:
OnInit:
OnDeinit:
OnTick:
Journal:
2019.05.14 17:37:14.686 2018.01.03 23:36:58 MyEA! GBPAUD,H4: GBPCAD Error
2019.05.14 17:37:14.686 2018.01.03 23:36:58 MyEA! GBPAUD,H4: GBPUSD Error
2019.05.14 17:37:14.686 2018.01.03 23:36:58 MyEA! GBPAUD,H4: GBPAUD tick number 221179, at 2018.01.03 23:36:58 000 Ask = 1.72479 Bid = 1.72459
2019.05.14 17:37:14.686 2018.01.03 23:36:58 MyEA! GBPAUD,H4: === Now process tick 221179
Where am I mistaken?
I'm sorry for my zero level skill :D
It gives me 00 again :(
My global area:
OnInit:
OnDeinit:
OnTick:
Where am I mistaken?
I'm sorry for my zero level skill :D
I'm sorry for my zero level skill :D
OnInit - the 3 new lines should go before everything.
I did it. But it's very strange: the timer for those two extra pairs does not work...
I did it. But it's very strange: the timer for those two extra pairs does not work...
Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
Corrected
The function linked to, opens a hidden chart for the symbol/TF in question (if not already open,) thus updating history, and temporarily placing the symbol on Market Watch (if not already there,) so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't also return zero the first call.
Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
Corrected
The function linked to, opens a hidden chart for the symbol/TF in question (if not already open,) thus updating history, and temporarily placing the symbol on Market Watch (if not already there,) so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't also return zero the first call.
You're right. No worries though, because the only things we do in OnInit, here, is to initialize arrays for storing names of symbols, and to prepare some file handles for reading our own data files. As to the bids and asks prices (i.e. 'tick' data), we're only accessing them in OnTick, and mostly from our own data files as well, since MT4 strategy tester always return zeros when queried on such data of other symbols (note that this behavior differs from the retrieval of OHLC data, which people are more familiar with).