Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions


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 09-02-2006, 03:34 PM
deeforex's Avatar
Member
 
Join Date: Oct 2005
Posts: 91
deeforex is on a distinguished road
Using Arrays to track info for All Open Orders

Could someone show me a snippet of an array for logging the details for all open orders? I want to be able to track information on all Open orders such as OrderOpenPrice and order profit. Then I would like to use the information in the array to find the minimum and maximum values. I've tried all sorts of thing but nothing seems to work.

Thanks in Advance!!!
dee
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-02-2006, 04:38 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Cool very good and generic idea!

Quote:
Originally Posted by deeforex
Could someone show me a snippet of an array for logging the details for all open orders? I want to be able to track information on all Open orders such as OrderOpenPrice and order profit. Then I would like to use the information in the array to find the minimum and maximum values. I've tried all sorts of thing but nothing seems to work.

Thanks in Advance!!!
dee
dee,

It's a very good and generic idea! this array could be used for a lot of purposes!

I'll give it a hand!
__________________
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!
Reply With Quote
  #3 (permalink)  
Old 09-02-2006, 05:46 PM
deeforex's Avatar
Member
 
Join Date: Oct 2005
Posts: 91
deeforex is on a distinguished road
Quote:
Originally Posted by codersguru
I'll give it a hand!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-12-2006, 05:56 AM
deeforex's Avatar
Member
 
Join Date: Oct 2005
Posts: 91
deeforex is on a distinguished road


I'm desperate here. I've been trying all night to get my array to work but nothing happens. I've realy tried to be self-sufficient and to try to learn but I still can't get to where I need to go. If someone could please have mercy upon me and lend me some assistance....PLEASE!!!!!

I'm running a grid script but would like to track how many lots I'm running by Symbol. I want to be able to add up what my total position is by lotsize. Let's say I have 0.10, 0.10, 0.10, 0.10, 0.20, 0.30, I want to be able know that I have the equivalent to 0.90 lots. I would also like to know the minimum and maximum lot sizes....0.10 and 0.30

Code:
      ArrayResize(OrderArray, i);
      ArrayInitialize(OrderArray,0);
      
      cnt = 0;
      for (i = 0; i < OrdersTotal(); i++)
      {
         if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)  &&  OrderSymbol() == Symbol() )
         {     
            OrderArray[cnt][PROFIT] = OrderProfit() + OrderSwap();          
            OrderArray[cnt][OPEN] = OrderOpenPrice();            
            OrderArray[cnt][LOTS] = OrderLots();

            if(OrderType() == OP_BUY)                                
            {
             ////// I can't get anything to work!!!!!!!

               BuyLots += OrderArray[cnt][LOTS];

             ////// This returns Zero when I place BuyLots in my Comments

             ////// This returns error messages
             MaxBuyLots =ArrayMaximum(OrderArray[LOTS],WHOLE_ARRAY,0);

            }
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-12-2006, 06:05 AM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 287
phoenix is on a distinguished road
you always count the 0th index

anyway that the great idea .. i agree, coderguru

looking forward to see your great code soon

Last edited by phoenix; 09-12-2006 at 06:07 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 09-12-2006, 04:33 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Cool More about Arrays

deeforex,

I'm writing an article right now about this issue !

Please track it at:
http://www.metatrader.info/node/161
__________________
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!
Reply With Quote
  #7 (permalink)  
Old 09-12-2006, 06:01 PM
deeforex's Avatar
Member
 
Join Date: Oct 2005
Posts: 91
deeforex is on a distinguished road
Quote:
Originally Posted by codersguru
deeforex,

I'm writing an article right now about this issue !

Please track it at:
http://www.metatrader.info/node/161

....Today we are going to study an example of 2 dimensional array and a very useful code that "Using Arrays to track info for All Open Orders" (Do you hear me deeforex ?)
I'm listening loud and clear Thanks Codersguru!
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
Arrays in MQL4 clippertm Questions 5 08-11-2008 01:16 AM
Too much distance from real price in Open Orders echnaton Metatrader 4 2 02-25-2007 11:05 AM
close all open orders script forextrend General Discussion 2 12-17-2006 06:16 AM
Script to close open orders... babarmughal Expert Advisors - Metatrader 4 1 12-13-2006 04:50 PM
How do I open and close multiple orders for a single account? iboersma Questions 4 05-26-2006 01:28 PM


All times are GMT. The time now is 05:02 AM.



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