Bars Since Order Open
4 replies
sdstrading
8 years ago #113769
Hi,
I seem to be having an issue with the Bars Since Order Open Function. My EA trades perfectly fine without this line however as soon as I add in Bars Since Order Open the EA doesn’t make any trades.
I want the EA to wait 2 Bars before its makes the next trade after any previous trade. Magic Number is set to 0 (Zero).
I’m guessing because i have this code it doesn’t trade because their hasn’t been a trade.
Does anyone know of a work around that i can add with this code to start the trading?
Thanks in advance.
tomas262
8 years ago #130780
Hi,
have you tried to use “Bars Since Order Closed()” instead? Because it returns number of bars since the order was closed for order with given Magic Number. If you’ll set Magic Number to 0, it will return number of bars since last closed order.
So it should work just by adding following rule to your entry condition: If (Bars Since Order Close(0) >= 2)
sdstrading
8 years ago #130792
Seems that what i’m wanting to do cannot be achieved using the built in functions.
For those wanting to know the work around.
Create 2 variables:
BarsToNextOrder: 2
BarsToNextOrder2: 0
Edit Ordering Rule
Add new condition: BarsToNextOrder2 <= 0
Then In Order Management Assign Variable
BarsToNextOrder2 = BarsToNextOrder
Create a new rule
in order management assign variable
BarsToNextOrder2 = BarsToNextOrder2 – 1
thanks,
javiersfr
8 years ago #132510
sdstrading,
I have the same as you have.
I’ve been testing with different values of BARS SINCE ORDER OPEN and I believe this function is not working when we use two digits; I mean the function works ok from 1 to 9 bars distance, but it stop working properly when I type 10.
I hope Mark can put some light on it.
Thanks in advance Mark.
We wait for your news.
tomas262
8 years ago #132515
I just tried to make an example in Wizard I attach here – use exit after 15 bars on 30 min timeframe and it works well.
Viewing 4 replies - 1 through 4 (of 4 total)