Page 1 of 1

only 1 entry per day

Posted: 12 Nov 2009
by raven
When trading on 5 minute bars on a multi-day chart (=day after day is charted on a 5 minute base), how to manage it that only 1 entry per day is made if condition for entry is met? (Problem: conditions are met several times a day but only the first match should be traded.)

Does anybody know? Many thanks in advance.

Posted: 12 Nov 2009
by TJ
just add a counter to the code.

if an order is filled... counter = 1.

if counter is larger than zero, then don't trade anymore.



the above is called pseudo code...
it is plain English... written in semi computer logic.
writing out your thoughts this way will help you to
organize your thoughts into programming codes.

Posted: 12 Nov 2009
by raven
That's a good idea, but to use it on a chart with more than one day with 5 minute bars (as described above) I would have to reset the counter at the end of each day. Otherwise trading would stop after the first trade for all following days. This is a matter especially when backtesting.

Thanks for any suggestion.

Posted: 12 Nov 2009
by TJ
you have the right idea...

you just have to reset the counter everyday !!!


QED

Posted: 12 Nov 2009
by brodnicki steven
I'm not a great EL programmer but to reset the counter, I think you could do something simple like-

if date <> date[1] then counter = 0;

Maybe someone else could supply an example of the counter code, to help him out. We're not all programmers here, most are traders, learning to program.

Posted: 12 Nov 2009
by raven
Special thanks to steven for the code. Here is my way (and it works):

variable: counter(0);

condition1 = marketposition <> 0;
if condition1 then counter = counter + 1;
if time this bar = 1000 then counter = 0;

"time this bar" is the time when I want to reset the counter.