Robot develop based on bar patterns, i need help in patterns logic

 
I have develop 5 Expert robot, and this one is good one, but need your help.

I have develop expert base on bars patterns. 
following tutorial : https://www.tradingsetupsreview.com/10-price-action-bar-patterns-must-know/

Now some patterns return good result, but some return always in lose...

Pattern name: "Bar reversal pattern" is good pattern, but its return lose if Currency has more then 40 spread.
Work Good in EURUSD, NAZUSD,  USDCAD, USDJPY

Actually my problem is, why pattern not always work?
I have attach my expert. 

Any one want to make it better? 

Please fix logical and missing things, please improve this and also share with me :) 

For Testing: select pattern type from expert input setting. you can check single pattern or multiple.
Files:
 
asad998: Actually my problem is, why pattern not always work?
  1. Nothing works 100% in the markets.
  2. All patterns should look at previous bar, not bar zero. Move the new bar code to OnTick, fix all [0].
 
whroeder1:
  1. Nothing works 100% in the markets.
  2. All patterns should look at previous bar, not bar zero. Move the new bar code to OnTick, fix all [0].

Yes i have notice this thing, if 1 bar say "market is bullish" then next bar say "market is bearish".
Before market go bullish, market start bearish. (so i get lose)

=> Fix all at [0]
If i trade buy order, and on sell signals, i close previous orders then open sell signal,
so i am going always in lose :( 
 

The  EA is a robot based mostly on false break outs & bounces of trend lines ( next just TLs)

  The first step is to choose if the EA will be done in MQL4 or MQL5 . In the robot will use just one indicator -ATR - Average True Range, mostly from 10 bars (number in bracket) and that could be count like this: Add High – Low values of last 10 bars and then divide by 10. 

      Because my English is not the best, for better understanding, all logical part are marked with numbers, letters,… , plus every important part has a picture or more with text too. 

       The job has more than 1 part and in one of following part it will include a testing too.  Every next part will just add more features, that will be just tuned the ATS for better profits. 

The most important thing in development is the team you work with.***