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.
- How to open more than one order at a time by Ea
- [ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4.
- Envelope 2.11
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
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
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.
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.
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
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
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