MQL4 - automated forex trading   /  

Forum

Trading more than one currency

Back to topics list To post a new topic, please log in or register

avatar
7
Roets 2006.01.19 18:19 
What piece of code do I need to add to my EA to be able to trade more than one currency at a time? I want this EA to look for signals in at least the four majors for a start.
article

Automated Trading Championship 2007 Has Begun!

Today is the 1st of October, the day when the Automated Trading Championship 2007 starts. Registration and checks of Participants are finished. 603 Participants are admitted to the Championship.


avatar
17
Maratha 2006.02.04 02:12 
Wouldn't the 'pair' variable in every function achieve this? For Example,
double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)

in the above function, if you use the right symbol, wouldn't it give you the values that you are looking for?

avatar
29
CockeyedCowboy 2006.02.18 19:52 
Toets and Maratha

the above function call will give you the MA value of the given symbol and by ratating the symbol string you could get the different MA values for a given symbol list. This will not give you the orders in the different currencies. For that you need ordersend() function which you can place orders in which ever currency you wish by changing the symbol, as well, (simular to the iMA() function). When doing this, care must be taken with what you feed the ordersend function in referance to price data. If you say to buy EURUSD at the askprice when your on a GBPUSD chart you will be sending it the ask price of the GBP not the EUR. You will need to access the MarketInfo() function and retreive the correct price data. All the other inputs to the OrderSend() function will have to be that of the currency pair referanced in the ordersend() function or possible Errors 129 and 130 will be generated. I beleive that most of the other order function you will need to use the OrderSelect() function to gain the orderticket number to use them.

To answer your question. There are two ways to do it the above way in one EA the hard way or to have multiple copies of the EA running with it attached to different currencyies, the easy way.


Hope this helps

The CockeyedCowboy

avatar
4
mikejohnson 2006.03.18 04:52 
marketinfo only gives the current bid/ask, i think.
and, no need to run multiple copies of an EA..

try:

double chfjpy[][6];
double nzdusd[][6];

ArrayCopyRates(chfjpy,"CHFJPY",0);
ArrayCopyRates(nzdusd,"NZDUSD",0);

nzdusd[0][4]; //currenct bar's close of nzdusd
chfjpy[20][4]; //chfjpy close, 20 bars back in time.

avatar
29
CockeyedCowboy 2006.03.19 06:37 
mikejohnson

When placeing an order in a different currency then the one on your chart you need to address the current Bid and Ask price of that currency from the MarketInfo window in order to place the order at the current (correct) price. Copying the price arrays into new array variables may not give you uptodate prices especially if your cross boarders between currencies with in your charts. If your needing complete data series for market analysis then your way is good but for placing orders your better with the current Bid Ask form the market infor window for that currency.

The CockeyedCowboy
Back to topics list  

To add comments, please log in or register