Reply

EA Opening trades per bar open

19 replies

MasterSye

Subscriber, bbp_participant, community, 80 replies.

Visit profile

8 years ago #114093

Hi. I made an EA that’s supposed to evaluate rule on next bar open. Everything is well during first few days of historical testing in strategy, but then after 2 weeks worth of data in the tester, it started opening trades per bar, and it no longer follows the conditions I laid out. Does anyone have similar issues like mine? If so, how did you resolve it? I need help with this one please. Any assistance or suggestion would be greatly appreciated. Thanks in advance.

0

MasterSye

Subscriber, bbp_participant, community, 80 replies.

Visit profile

8 years ago #132918

Hi Zoki. So if i’m not mistaken, your strategy is to open a trade after close of the bar/candle. This means you can use IsBarOpen function to make sure that only one trade is opened per bar, unless of course that you made a condition where 2 trades or more should be opened once you have a confirmation to enter the market. If you prefer that your strategy analyzes the previous bar before with the confirmation of MA crossover or any indicator for that matter, then you should use the default shift = 1. This will prevent your EA to open trades during a candle formation.

0

Zoki

Subscriber, bbp_participant, community, 18 replies.

Visit profile

8 years ago #132964

Hi MasterSye. Hmm, it seems that for my needs, if I check “Evaluate rule on bar open only”, it does same as maybe IsBarOpen would do. What happened before I used this, was, for instance, I had TP 5 pips and SL 5 pips and I wanted only one trade to execute during the candle formation, but then if the price was volatile and made 50 pips inside that candle, my trade was opened again many times, before that candle was completed, hitting sometimes TP, simetimes SL, etc., opening new trade every time when old trade was closed, what happened also in not best situation too, what caused then (beside spreads) many losses inside that candle too.

 

I use also shift = 1 comparing to shift = 0, (to check the slope of indicators mostly) and it seems problem is solved in similar way, if I use “Evaluate rule on bar open only”. But that’s something I would need to check again, if it would open multiple trades inside one candle, without using “Evaluate rule on bar open only” or IsBarOpen, in case of using shift 1, shift 0.

0

MasterSye

Subscriber, bbp_participant, community, 80 replies.

Visit profile

8 years ago #132971

Hello Zoki. That is why you need to use IsBarOpen is True to prevent multiple trades opening at the same time in the same bar. Evaluate rule on bar open only is used for back testing in the strategy tester. That is what I know. If you’re evaluating your strategy on the current candle instead of the previous one, there is a possibility that trades would open multiple times. Same thing happened to me even when I have IsBarOpen condition in my rules. Perhaps you should use shift 1 – meaning you should let your EA analyze your strategy starting from the previous candle, not the current one.

0

Zoki

Subscriber, bbp_participant, community, 18 replies.

Visit profile

8 years ago #133193

MasterSye, thank you for advices. I will certain at least try IsBarOpen, when I move from strategy tester into real time trading, or at least I will know where is problem, when I will get multiple trades inside current candle (what I thought I got under control in strategy tester). Thank you for now.

0

Viewing 4 replies - 16 through 19 (of 19 total)

1 2