• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 11:43pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 11:43pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Printable Version

Similar Threads

3 Bar Fractal with mid-bar and bar on each side 8 replies

trade number fixed in each bar 0 replies

Limit number of open orders in metatrader 1 reply

Can u point me to code 2 show each bar with a higher high & higher low? 2 replies

Pin bar, pin bar, pin bar 0 replies

  • Commercial Content
  • /
  • Reply to Thread
  • Subscribe

How can you limit the number of orders in each bar?

  • Post #1
  • Quote
  • First Post: Jan 13, 2008 5:19pm Jan 13, 2008 5:19pm
  •  JFonseca
  • | Commercial Member | Joined Jan 2007 | 180 Posts
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
  • Post #2
  • Quote
  • Jan 13, 2008 6:01pm Jan 13, 2008 6:01pm
  •  Mtav
  • | Joined Apr 2006 | Status: Member | 278 Posts
Quoting JFonseca
Disliked
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
Ignored
hi
use


if (XY != Time[0])
{
open order.....

....
XY=Time[0];
}
OldSchool
  • Post #3
  • Quote
  • Jan 14, 2008 12:33pm Jan 14, 2008 12:33pm
  •  JFonseca
  • | Commercial Member | Joined Jan 2007 | 180 Posts
Hi,

I have already tried that 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
  • Post #4
  • Quote
  • Jan 14, 2008 12:55pm Jan 14, 2008 12:55pm
  •  JFonseca
  • | Commercial Member | Joined Jan 2007 | 180 Posts
Hi,

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

J Fonseca
  • Post #5
  • Quote
  • Last Post: Jan 14, 2008 1:03pm Jan 14, 2008 1:03pm
  •  The Jedi
  • Joined Mar 2007 | Status: A jedi seeks no title | 655 Posts
Quoting JFonseca
Disliked
Hi,

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

J Fonseca
Ignored
Good catch, was about to say that. Of course, don't forget to set a mechanism in there to clear the global variable at the start of every bar so that the system can reset.
Never underestimate the powers of the Force.
  • Commercial Content
  • /
  • How can you limit the number of orders in each bar?
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2021