Forex
Google

Go Back   Forex Trading > Programming > Metatrader Programming
Forex Forum FAQ Members List Calendar Mark Forums Read


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

 
 
LinkBack Thread Tools
 
Old 01-17-2008, 09:09 PM
prouton prouton is offline
Junior Member
 
Join Date: Sep 2007
Posts: 3
prouton is on a distinguished road
Need Code for determining # of positions currently open

Hi. I need a code snippet for determining number of positions opened. I am trying to work a piece of code for an EA that will allow 2 different variables for sending an order. the 1rst would be based on an external interger for lot size - that would be the 1rst lot size of the order sent. the second and subsequent lots would be based on an account balance/mulitplier (exernal int) figure. I just want to control the size of the initial lot, but be able to independently set the multiplier for subsequent lots. PLEASE HELP! Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 01-17-2008, 10:42 PM
Michel Michel is offline
Senior Member
 
Join Date: Feb 2006
Posts: 502
Michel is on a distinguished road
Quote:
Originally Posted by prouton View Post
Hi. I need a code snippet for determining number of positions opened. I am trying to work a piece of code for an EA that will allow 2 different variables for sending an order. the 1rst would be based on an external interger for lot size - that would be the 1rst lot size of the order sent. the second and subsequent lots would be based on an account balance/mulitplier (exernal int) figure. I just want to control the size of the initial lot, but be able to independently set the multiplier for subsequent lots. PLEASE HELP! Thanks
something like this ?
PHP Code:
   BuyLots 0SellLots 0;
   for(
int i OrdersTotal()-1>= 0--)
   {
      if(!
OrderSelect(iSELECT_BY_POSMODE_TRADES)) continue;
      if(
OrderSymbol()!= Symbol() || OrderMagicNumber()!= Magic) continue;
      if(
OrderType() == OP_BUYBuyLots += OrderLots();
      if(
OrderType() == OP_SELLSellLots += OrderLots();
   } 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fx Open Positions & Market Hours drgoodvibe Tools and utilities 1 09-07-2006 08:08 PM
Can't get EA to close 2 Open positions??? skorcht Expert Advisors - Metatrader 4 4 08-07-2006 10:15 PM
Close all open positions jonjonau Expert Advisors - Metatrader 4 6 07-12-2006 05:01 AM
Close All Open Positions? lonespruce Metatrader 4 9 06-22-2006 07:20 AM


All times are GMT. The time now is 12:20 PM.