How to plot the blue line straight

 
I am trying to write an indicator that I am using on tradingview. Everything is fine but I couldn't plot it straight. It supposed to be as the photo I attached. What's wrong with my code?
Files:
 

Decompose this line:

PMAXBuffer[i] = (PMAXBuffer[i-1] == FUB[i-1] && MABuffer[i]<FUB[i] ) ? FLB[i] : (PMAXBuffer[i-1] == FUB[i-1] && MABuffer[i]>FUB[i]) ? FLB[i] : (PMAXBuffer[i-1] == FLB[i-1] && MABuffer[i]<FLB[i] ) ? FUB[i]  : FUB[i] ;

into a couple of ifs in several lines and go through it with the debugger! Here you assign always FLB[i] in every branch of ? and :?

 
Carl Schreiber #:

Decompose this line:

into a couple of ifs in several lines and go through it with the debugger! Here you assign always FLB[i] in every branch of ? and :?

Thank you for the spot that you made me see. Wrong part has been corrected and I realized 1 more line that I didn't write. Now its working. Best regards.