I am developing an EA to trade from user defined support and resistance zones. Generally price will be outside the zones when the EA is initialized but sometimes that is not the case. If price is within a zone I have blocks to change both a flag (BuyZone_5 or SellZone_4) and variable (BuyZoneBars or Sell ZoneBars).
It works correctly for zone 5 (buy zone) but not zone 4 (sell zone). It is determined by the close price of candle ID 1.
For sell trades if Close candle id 1 is greater than SellZone_4 it works correctly but if it is less than SellZone_4 then it still acts as if it is greater than the level. This is because it thinks that SellZone_4 is equal to 0.
A copy of the EA can be seen here https://fxdreema.com/shared/rrJB9hDsd.
I have a number of comment blocks so that I can see where the EA breaks down. Unfortunately I can't understand why it is happening.
If you enter a value in Res_1 that is say 50 pips above the close price then one comment will say that SellZone_4 + true even though it isn't so.
Comment block 237258 will give the correct value but comment block 473968 will give a value = 0. This is very confusing to me as block 237258 activates before block 473968 and the only block in between 473965 makes no change to the variable.
I would really appreciate some help with this? @fxDreema @miro1360 ?
If I change the value of Sup_1 (zone 5) it works correctly but not for zone_4. I;ve spent about 6 hours trying to figure this out today but with no luck.