![]() |
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 |
use if (XY != Time[0]) { open order..... .... XY=Time[0]; } |
I´ve already tried 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 |
Solved the problem! Hi, I already found out what the problem was. I declared a local variable, and should have declared a global variable. J Fonseca |
|
© Forex Factory