How can you limit the number of orders in each bar?
  #1 (permalink)  
Old 01-13-2008, 09:18 PM
Freshman
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
JFonseca is on a distinguished road
Default How can you limit the number of orders in each bar?

Hi,

I´m coding my system,and I´m having some problems trying to limit the number of open orders for each bar. In my system, the decision is made in the opening of a new bar, and if the conditions aren´t perfect, the EA should only reanalyse in the opening of next bar.

I´ve tryed Volume[0] > 10, but sometimes it opens 2 orders because the EA runs a second time before Volume [0]>10 and sometimes it doesn´t open any order because the Volume goes past 10 very quickly.

Can anyone help me?

Thanks,

J Fonseca
Reply With Quote
  #2 (permalink)  
Old 01-14-2008, 04:37 PM
Freshman
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
JFonseca is on a distinguished road
Default

Hi,

I have also already tried with Open[0] and with Time[0] and none worked. I found out that when the EA returns to the beggining, it forgets the XY value.

I did this:

datetime XY;
Print ("before if XY = ", XY)
if (XY != Time[0])
{
Execute program
}
XY = Time [0];
Print ("End of program XY = ", XY)
return (0);
}

What´s wrong with this? How can I fix it?

Thanks,

J Fonseca
Reply With Quote
  #3 (permalink)  
Old 01-14-2008, 04:43 PM
Freshman
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
JFonseca is on a distinguished road
Default

Hi,

I already found out what the problem was. I declared a local variable, and should have declared a global variable.

J Fonseca
Reply With Quote
Reply


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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
place 2 pending orders pgtips MetaTrader and ZeroCode 1 11-15-2007 03:15 PM
Merging orders TraderSeven MetaTrader and ZeroCode 7 12-10-2005 01:19 AM
Closing Pending Orders Rastarr MetaTrader and ZeroCode 0 06-07-2005 11:52 PM


All times are GMT. The time now is 10:34 PM.
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now