Reply

Only open one pending order while bar is still open

3 replies

ddilbeck

Subscriber, bbp_participant, community, 21 replies.

Visit profile

5 years ago #114811

I’m working on an EA that opens a pending order once specific criteria is met.  I have it analyzing the current open bar to ensure precise entry, as sometimes the criteria does not get met until mid-way into the current bar. I am getting it to work, however, upon doing some backtesting it looks to open thousands of pending orders (canceling the previous one every time) until the stop price is met.  Then once the order is actually placed, if the current bar is still open, it attempts to open new pending orders for the same criteria. It is not successful at opening the additional order(s) because the magic number for the order is already in a trade (Which is what it should do) Obviously this would tax the resources of a machine if I have this same EA running on several different pairs which meet the criteria at similar times.

 

I have used the check mark on “evaluate rule on bar open only” and the EA works as I want it to with only entering the one order, but only if the criteria is met at the time the bar opens.  Using this makes me miss out on some potentially good trades.

 

My question is, how can I get the EA to only place one pending order per open bar? Then not have it look to place any additional pending orders during that current bar as well without having to check the bar open only checkbox?

Thank you in advance!

0

tomas262

Administrator, sq-ultimate, 684 replies.

Visit profile

5 years ago #135549

You can force EA to do something only at bar open when you use condition like shown on screen even without checking ‘evaluation on bar open only’

0

ddilbeck

Subscriber, bbp_participant, community, 21 replies.

Visit profile

5 years ago #135550

Yes, I am aware of that condition, however, this will not solve my problem as it will still only check at bar open, not mid-way thru bar formation. I want the EA to keep checking after bar open but then stop looking once criteria is met and pending order is placed.

0

alirazzak

Subscriber, bbp_participant, community, 33 replies.

Visit profile

5 years ago #136431

Hi 

I have situation like you too before, and finally find the solution :

 Use this in condition ->  “OrderOpenedThisBar”  –> is not –> True    ( Its return to true when order with magic number opened at current bar) 

                                        “OrderClosedThisBar”  –> is not –> True    ( Its return to true when order with magic number closed at current bar)

0

Viewing 4 posts - 1 through 4 (of 4 total)