EA with a sweep of a inside bar
-
Hello,
I’m looking to create an EA with a sweep of an inside bar.
Strategy
We wait for an inside bar to form on the M15 (which is a candle that stays between the high and low of the previous candle).
In case of buys we want to see a sweep below the inside bar. If this happens we look for an entry on the M5 timeframe.
When a bullish candle forms and closes, we take a entry at the high of this candle if the price reaches this point. Example 2: If it breaks below we wait for another bullish candle presents itself. At the second bullish candle it is allowed to have a inside bar before we have a entry.
For sells we want to see the opposite naturally.The EA should start over when we have a new M15 inside bar.
Questions
Currently I’m stuck at forming the blocks for the sweep.
The amount of candles between the inside bar and the bar where we take an entry from is not always the same. Minimum is 2 candles after the inside bar (example 1). Is there a possibility to deal with a pattern that varies in the amount of candles?I’m thinking of condition blocks with the following conditions (in case of buys again):
- A candle (not necessarily the first one) after the inside bar has to break below the low of the inside bar.
- The candles before the break cannot break above the high of the inside bar.
- We take a entry from the candle that breaks above a bullish candle.
Quite new to fxdreema.
Any advice/tips are welcome.Examples
1-Sweep M15:

1-Entry M5 with 2 candles:

2-Sweep M15:

2-Entry M5 with multiple candles:

-
That is certainly an ambitious project. Have you created any initial project to begin with?
-
Thanks for your reply.
Yes, I went through a course where I learnt to build basic EA's.
For example break & retest, morning/evening star/BB mean reversion, etc. -
Sure. No problem. Meanwhile, we can work on your idea here. Did you develop any initial project in fxDreema?
-
I misinterpreted your question I think.
Yes I have, but I don't have much yet. I am still researching on how I would build this.
https://fxdreema.com/shared/TOp7Ufrzd -
Ok. Let's begin with the inside bar definition. Does it mean both high and low are supposed to be below/above previous candle's high and low? I mean both at the same time?
-
Yes exactly.
-
@InfinityGlobal Ok. Here you have it:
https://fxdreema.com/shared/sciAFAELc
Can you please confirm you understand the logic?
-
Super.
Yes I understand what's happening.
The high or low of the inside bar could also be equal to the high or low of the previous bar and it would still be an inside bar.
I forgot to mention that. -
Where could we go from here? Any tips on what I could look at?
-
Good. New we move to the nest step: ' we want to see a sweep below the inside bar'. we need a detailed description of what you mean by that. Can you please elaborate?
-
I made an attempt to elaborate. I hope this will make the next step clearer.
Description of a sweep below the inside bar (buys):


https://www.tradingview.com/x/ZafCYkWF/
Description of a sweep above a inside bar:


https://www.tradingview.com/x/cPM3YGCP/
2 sweeps close after each other:


-
This is far more complicated because according to those examples, that 'x' distance can be unlimited. It can be one candle behind or 20 or 100. Is there any limitation to search back in time?
-
I can imagine it being very complicated. Is it possible though? Would you know what I need to look out for?
In theory the distance can be unlimited indeed. I will have to look in backtest data for what candle limitation would be realistic. -
@l-andorrà is very helpful and has been helping here for years, he has things to do sometimes so he can take a little time to respond. I would split this into smaller test projects. For this get your start candle time (where the inside bar happened), and draw a horizontal line to the current time at the highest or lowest price using market properties, (time now - period() is candle id 1 time). you can see from this line if a sweep has happened, then work out what to do next.
this https://fxdreema.com/shared/LA9q9It6 will show how to get ID 1 time to use. -
That's not a problem. I appreciate all the help!
Thank you, I'll look into it. -
@InfinityGlobal jstap is right. I'm not here as much time as I would like. The short answer to your question is yes, your project is feasible. However, it cannot be done with unclear or ambiguous conditions. This is the first lesson I had to learn when I began in fxDreema long ago. I'm happy to help you, but that will take a long time if you are patient enough. Again, jstap's recommendation is the best one. Create smaller segments of your project and then we will be able to review them here.
-
Took me a while to find but maybe this tutorial could help with the understanding of candle formations (not my work)
https://fxdreema.com/forum/topic/4321/tutorial-08-candle-formations
-
That tutorial can definitely help, Miro has lots of very good help on here, bear in mind though this uses candle ID's, so every new candle, it goes out of sink by one.
-
@l-andorrà
Thank you for your insights, I will definitely keep these in mind. I'll begin with the input I received.