When you are by your definitions in "Range" then you will want to consider using BuyLimits and BuyStops outward from price until you get to the area you will call "Trend." In trend you will want to profit from a trend move. On the two lines you represent as 1 & 2 I believe these could be your "unknown" area where you work to get flat in your net lots.
This will allow you to pre-identify key trigger areas that will let you know you are in trend, in range or in the unknown areas.
Intentional errors in implementation, and use in demo account only eurusd ... Very, very interesting ...