Code for Level of Control

 

Hello to the ones opening this topic, 

I am currently building an EA that will support my manual trading, however i'm stuck with one on the condition and i cannot come around with a solution. 

I have read and tried to use hints from 2 topics of this forum : https://www.mql5.com/en/forum/192802  && https://www.mql5.com/en/forum/159229 but after reading it i still cannot see a way that would help me. 

Im asking in this forum because i believe that someone with more experience in mql4 coding could have a view to unblock my brain. 

Let me explain the goal of this topic, the idea is to have 2 levels of control during the London Session, we always start with the lows and highs of night sessions. A simple day would looks like the one below where prices on London session break above night highs or below lows and stay under for the whole session (no problem for me to code it). 

 


Now, this is where i get stuck. The bottom line is : As long as prices break and stay above or below the level of control, the level will remain as long as we do not have a candle closing under/below the level. 


Example of multiples level of control created on lows during the London sessions :


1) Lows are set from the night session.

From there this is where i have troubles : 

2) The candle make a low under night session but close above it, then the new low level is from low of candle 2)

3) The next candle make a low under 2) and close above it, new low is set from low of 3)

The level of control from 3) is then broken and price stay under. This level will remain until 4).

4) The candle close above level 3) and set new low level for the session to be broken, (level 4))

5) Price make a low under level 4) but the candle close above, then the new session lows are from candle 5)


Example of multiples highs during London session :

We have in 1) the level of control for highs set by night session.

In 2) The candle close under the level and create new high located from this same candle.

Then prices break and stay above level 2) again as long as we do not have a candle closing under this level of control will remain for the session. 

3) We have a candle closing under level 2) which then create a new high to be broken for the session. 


What boggle me is how to code this level of control that is changing during the session and must be kept by the EA once the prices have broken it and until prices comes back under/above the level.


I hope that i have not being to much confusing, of course if you need me to explain more details i'll be there and i'll be happy to share the end result of the EA. 

Thank you very much in advance to anyone helping on this project. 

 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
 
Keith Watford:
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.

Sorry for the confusion and thank you for reassigning to the correct section

Reason: