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
If you don't want to reply to his question, don't reply, it's simple. No need to offend people.
And believe me, it's available for me too, if I posted everything I want to post, I have 1000 rating points more, at least.
if he had done some research and looked in Code Base then he had find for example https://www.mql5.com/en/code/11176
and you can find more such examples the way he is asking now is looking to me and i guess to others
that he doesn't do enough to learn how to code and wants to get from others to code for him to get examples how to do trade one EA different symbols
without doing any attempt himself...
Like CodeMonkey wrote to xennon
'The problem here isn't that it cannot be done, it's that you haven't bothered to even try and do it. '
.
if xennon gets doing this replies he doesn't like then it is also his way reacting to it a wrong way
think you understand the situation how i see it...
if he had done some research and looked in Code Base then he had find for example https://www.mql5.com/en/code/11176
and you can find more such examples the way he is asking now is looking to me and i guess to others
that he doesn't do enough to learn how to code and wants to get from others to code for him to get examples how to do trade one EA different symbols
without doing any attempt himself...
Like CodeMonkey wrote to xennon
'The problem here isn't that it cannot be done, it's that you haven't bothered to even try and do it. '
.
if xennon gets doing this replies he doesn't like then it is also his way reacting to it a wrong way
think you understand the situation how i see it...
Of course, I agree.
But I also agree that if someone replies, there is no need to offend the OP (or any other user). I think this forum needs a better atmosphere.
xennon: is registrated from januari 2012 and now comes here with this Question ??
looks to me it's time for him to do some research by reading and learning
if he wants to make that EA then he has to come with his attempt if he gets problems making it
it is possible .... after more then 2 years he knows that now for sure
Yeah 2 yrs so what?! Does not mean I have been actively messing around in MQL does it? - in fact my collective experience with MQL is probably less than a month, TOTAL. I suggest you either contribute something positive and useful or xxxx. What a stupid and idiotic statement to make.
Yeah 2 yrs so what?! Does not mean I have been actively messing around in MQL does it? - in fact my collective experience with MQL is probably less than a month, TOTAL. I suggest you either contribute something positive and useful or xxx. What a stupid and idiotic statement to make.
I already advice you to watch your language. This is my last warning.
Thank you.
Yeah 2 yrs so what?! Does not mean I have been actively messing around in MQL does it? - in fact my collective experience with MQL is probably less than a month, TOTAL. I suggest you either contribute something positive and useful or xxxx. What a stupid and idiotic statement to make.
the example from codebase i pointed out ???? https://www.mql5.com/en/forum/149766/page2#915892
I am wondering is it's possible to have a single EA running on any currency pair, but have it monitor multiple currency pairs and respond to triggers as they arise in each pair.
Essentially I want a EA that will poll all pairs of interest, test pre-configured criteria on each one and respond with buy/sell/close/alerts as required.
I suspect this cannot be done, but would be interested to hear if anyone has any ideas as to how to achieve this without having to open a lot of charts and applying the EA to each chart separately mainly in the interest of efficiency (better to have 1 block of code instead of a dozen?)
Thx.
My money would be on a string array for the symbols and then go trough a loop for all symbols of interest
Something like
then
I am wondering is it's possible to have a single EA running on any currency pair, but have it monitor multiple currency pairs and respond to triggers as they arise in each pair.
Essentially I want a EA that will poll all pairs of interest, test pre-configured criteria on each one and respond with buy/sell/close/alerts as required.
I suspect this cannot be done, but would be interested to hear if anyone has any ideas as to how to achieve this without having to open a lot of charts and applying the EA to each chart separately mainly in the interest of efficiency (better to have 1 block of code instead of a dozen?)
Thx.
Hi xennon,
The short answer to your question is yes.
I've thought of doing something similar but haven't got around to coding anything yet so I'll give you the basic outline of how I would structure the code but not specifics as it would probably be better if you researched how to code each part yourself and referred to the codebase and other sources as coding examples as a learning exercise as it will help you more in future code writing than simply copying code from examples and pasting a solution together without really understanding what is going on and why, plus it will help in debugging code errors. Although the codebase can be confusing if you are unfamiliar with coding as some terminology can be difficult to follow.
Also as my idea hasn't been tested or implemented yet so there are possibly better ways to code it or bugs I have not foreseen as I am not a master coder by a long shot and am quite rusty in general so if anyone has any suggestions I am all ears and if there are errors please don't shoot me down.
The general idea is to use the millisecond timer event as the OnTick event will only work for the chart it is attached to so ticks for other currency pairs will not generate a tick event and the EA won't run but the millisecond event timer can trigger multiple times per second and monitor for price changes. Also use three arrays, one to store the strings of the symbols you want to use and another to store the price data.
I'll try to explain it a little. The array nameArray will store each symbol as an array but more importantly the element of the array can be used to set the position for other the other two arrays as they cannot use a string to locate a position in an array but the index value can. As ticks for each symbol are received at different times the data written to the PriceArray will not all be at the same time as some symbols are more active at different times so the second array stores the index for the PriceData array so it can be written to quickly without overwriting any past price data. The third array will write the necessary price data you require.
The code is a combination of code and english with what needs to be added. It is very simple but should provide you with a starting point for your idea. There are numerous gaps such as when to deal with the arrays when they reach the end but this is all part of the learning curve. I suggest getting the code to work with one symbol and then two, and so on to allow you weed out and fix any bugs in the code. As I've said this is just a rough draft so use it as such and improvements are possible, for example, you can use a Struct data type or an object instead of the three arrays to store the tick data but this design is a little simpler to start with and you can look at Structures and Object-Orientated programming at a later stage of coding.
I have tried to be clear but this may be very confusing for you so if you have any further questions about clarity let me know and I'll help where I can but unfortunately I do not have time to code anything like this.
Here is the pseudo code,
I simply use Global Variables to allow my ea monitor/make trades from within one chart.
Though you have to make your ea a bit more robust and does not specific to one chart.
Why would the following not work?
if (this is true){
ticket=OrderSend("GBPUSD",OP_SELL,lot,Bid,0,0,0,"",0,0,Red);
ticket=OrderSend("GBPJPY",OP_BUY,lot,Ask,0,0,0,"",0,0,Green);
ticket=OrderSend("USDJPY",OP_BUY,lot,Ask,0,0,0,"",0,0,Green);
}
pops an error 4106 symbol unknown
if (this is true){
ticket=OrderSend("GBPUSD",OP_SELL,lot,Bid,0,0,0,"",0,0,Red);
ticket=OrderSend("GBPJPY",OP_BUY,lot,Ask,0,0,0,"",0,0,Green);
ticket=OrderSend("USDJPY",OP_BUY,lot,Ask,0,0,0,"",0,0,Green);
}
pops an error 4106 symbol unknown