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 09-19-2006, 05:59 PM
kokas's Avatar
Senior Member
 
Join Date: Jun 2006
Location: Portugal
Posts: 284
kokas is on a distinguished road
Close all based on Magic

I need help, this is a very basic question, but... I'm not a coder, but I'm trying to code an EA for the first time,

So, I need to know how to close all trades based on MagicNumber variable...

I want to put an order but before close all open trades of that EA. Is this possible?

Thanks!
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 09-19-2006, 06:03 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Smile

Quote:
Originally Posted by kokas
I need help, this is a very basic question, but... I'm not a coder, but I'm trying to code an EA for the first time,

So, I need to know how to close all trades based on MagicNumber variable...

I want to put an order but before close all open trades of that EA. Is this possible?

Thanks!
An easy task my friend kokas:

1- Go to: http://www.metatrader.info/node/158
2- Download the Close All purposes script.
3- Set the option parameter to close by the magic number. (Note: You have to set the magic_number variable)
4- Show me your smile!
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
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 09-19-2006, 06:08 PM
kokas's Avatar
Senior Member
 
Join Date: Jun 2006
Location: Portugal
Posts: 284
kokas is on a distinguished road
eheheheh let me try this... I'm a little rusty in programming... But I want to learn MQL Your lessons are precious!
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 09-19-2006, 07:08 PM
kokas's Avatar
Senior Member
 
Join Date: Jun 2006
Location: Portugal
Posts: 284
kokas is on a distinguished road
Hi again... still nothing... Hope you read my private message
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 09-19-2006, 07:29 PM
lowphat's Avatar
Senior Member
 
Join Date: Sep 2005
Posts: 200
lowphat is on a distinguished road
u may can put something like this before your order
this isnt tested so i dont know if syntax is 100%

for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic) {
OrderClose(OrderTicket(), OrderLots(), Bid, 100, Red);
} }}}


for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
if (OrderMagicNumber()==Magic) {
OrderClose(OrderTicket(), OrderLots(), Bid, 100, Red);
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 09-19-2006, 07:42 PM
kokas's Avatar
Senior Member
 
Join Date: Jun 2006
Location: Portugal
Posts: 284
kokas is on a distinguished road
This was only the beginign of my problems... lolol
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
  #7 (permalink)  
Old 09-19-2006, 09:20 PM
lowphat's Avatar
Senior Member
 
Join Date: Sep 2005
Posts: 200
lowphat is on a distinguished road
been there done that
whut else is hanging you up?
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Close Open Trades EAs based on Equity Tradinator Expert Advisors - Metatrader 4 32 11-10-2009 04:26 PM
Magic MiniMe General Discussion 51 06-18-2007 10:08 PM
Open/close trade on same bar's close? WNW Expert Advisors - Metatrader 4 2 03-29-2007 06:37 AM


All times are GMT. The time now is 10:37 AM.



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