Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > Metatrader 4


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2006, 03:35 PM
Junior Member
 
Join Date: Jun 2006
Posts: 15
rbowles is on a distinguished road
Trade muliple currency Pairs

Most of the sample EA that come with metatrader have some code in it that do not allow more than one order at a time. What code would I use to allow more than one order if it is a different currency pair. For example if usdcad has an open position I do not want any more open. However I do want euros to trade if I signal is generated.

Thanks in advance

Randy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-07-2006, 03:58 PM
Administrator
 
Join Date: Sep 2005
Posts: 17,170
Blog Entries: 159
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Quote:
Originally Posted by rbowles
Most of the sample EA that come with metatrader have some code in it that do not allow more than one order at a time. What code would I use to allow more than one order if it is a different currency pair. For example if usdcad has an open position I do not want any more open. However I do want euros to trade if I signal is generated.

Thanks in advance

Randy
Most EAs are trading like this. And most EA are having magic number option which is doing it. And there is the other code which is protecting trading many EAs in one metatrader but I don't remember.
Check EAs (there are a lot on this forum), select one with Magic number option (in settings) and do the same with yours.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-07-2006, 05:28 PM
Junior Member
 
Join Date: Jun 2006
Posts: 15
rbowles is on a distinguished road
Quote:
Originally Posted by newdigital
Most EAs are trading like this. And most EA are having magic number option which is doing it. And there is the other code which is protecting trading many EAs in one metatrader but I don't remember.
Check EAs (there are a lot on this forum), select one with Magic number option (in settings) and do the same with yours.
I did find some with the magicnumber. Can somebody give me a brief description of what that is and how it functions. Once I have that I think I can work with it.

Thanks,

Randy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-07-2006, 06:12 PM
Administrator
 
Join Date: Sep 2005
Posts: 17,170
Blog Entries: 159
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Quote:
Originally Posted by rbowles
I did find some with the magicnumber. Can somebody give me a brief description of what that is and how it functions. Once I have that I think I can work with it.

Thanks,

Randy
My explanation is not good as I am not a coder.

But for example:

Code:
//Sell
   if (Order == SIGNAL_SELL ....

if(Total < 1) 
.....

Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink);
So every ticket it having magic number (some number let's say). Means that all the orders are opened with this number.
And then EA is trying to find the orders with the same numbers to modify, close with sl or with tp.

Code:
bool ExistPositions() {
	for (int i=0; i<OrdersTotal(); i++) {
		if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
			if (OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC) {
				return(True);
I could not find EA without magic number in my computer. Even very old EAs without magic numbers as the settings are having it inside the code:

{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-sl*Point,Ask+tp*Point,"qq-buy60",11603575,0,Blue);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-07-2006, 06:15 PM
Junior Member
 
Join Date: Jun 2006
Posts: 15
rbowles is on a distinguished road
I think I understand it now. I am a programmer and I just needed some time to digest it. I also found this link that might help others. http://www.metatrader.info/node/115
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 08-13-2006, 06:51 AM
Member
 
Join Date: Dec 2005
Posts: 58
techinvest is on a distinguished road
Quote:
Originally Posted by rbowles
I think I understand it now. I am a programmer and I just needed some time to digest it. I also found this link that might help others. http://www.metatrader.info/node/115
I use a similar function in which I count the # of trades from within the expert and write it to a global variable. Then you simply have to have the EA's running on different charts check that global variable for the # of open trades. Easy as pie
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display two currency pairs on one chart? Benna Metatrader 4 11 08-05-2008 11:59 AM
Brokers offering tight spreads on minor/exitic currency pairs jimbil Metatrader brokers 2 06-04-2007 01:54 PM
Derived Currency Strength Indicator from multiple pairs jswanson Metatrader 4 0 05-10-2007 09:40 PM
What are best medium volatility ranging pairs to trade? shibeng Expert Advisors - Metatrader 4 4 01-30-2007 06:57 AM
How Do I View More Currency Pairs? mikejody Metatrader 4 2 12-05-2006 01:50 AM


All times are GMT. The time now is 06:49 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.