Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-11-2006, 04:29 PM
Junior Member
 
Join Date: Oct 2006
Posts: 25
pooshkin is on a distinguished road
help me fix my ea

Hello
the idea is this :
only 1 trade per symbol allowed.
i use to do it like this:
int total = OrdersTotal();
if(total != 0 )
{
return(0); // dont trade
}
else
trade

but the problem is that i have other open position from manual trades\other EA
i need that the ea will open only 1 trade per symbol.

please help, thanks!
Attached Files
File Type: mq4 boo01.mq4 (5.2 KB, 12 views)

Last edited by pooshkin; 12-11-2006 at 04:32 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 12-11-2006, 05:57 PM
Senior Member
 
Join Date: Mar 2006
Posts: 793
Maji is on a distinguished road
Use MagicNumber to identify the trades placed by your EAs. Read up on Magicnumber by our gracious Coder's Guru and you will have a very good idea on what to do.

Good luck.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 12-11-2006, 06:13 PM
Junior Member
 
Join Date: Oct 2006
Posts: 25
pooshkin is on a distinguished road
where can i read about it?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 12-11-2006, 06:27 PM
Junior Member
 
Join Date: Oct 2006
Posts: 25
pooshkin is on a distinguished road
ok, i have 666 as magic number to trades that open in the ea
is this code any good?
Code:
   if(OrderSelect(ticket, SELECT_BY_TICKET) == true) // open trades
   { 
   if(OrderMagicNumber() == 666){
   return(0);} // no trades
   }
else
trade
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 12-11-2006, 07:29 PM
Senior Member
 
Join Date: Mar 2006
Posts: 793
Maji is on a distinguished road
Again, do a search, I am sure you will find Coder's Guru's lessons. There is nothing better than learning how to do it right.

I am providing you with a subroutine that will count the number of trades for a given symbol and a given magicnumber. You can call that to find the number of trades, and if it is equal to or less than a certain number, you can place your trades.

PHP Code:
int CountTrades(int MagicNumber)
{
 
int count=0;
 
int trade;
 for(
trade=OrdersTotal()-1;trade>=0;trade--)
 {
  
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
  
  if(
OrderSymbol()!=Symbol() || OrderMagicNumber()!=MagicNumber)
   continue;
   
  if(
OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)   
  if(
OrderType()==OP_BUY || OrderType()==OP_SELL)
   
count++;
 }
//for
 
return(count);

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 12-12-2006, 02:17 PM
Junior Member
 
Join Date: Oct 2006
Posts: 25
pooshkin is on a distinguished road
maji, thank you very much!!
I got it now.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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


All times are GMT. The time now is 01:29 AM.



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