My EA need some help

Hi guys. I really need some help in coding.
Currently I’m learning coding an simple EA. But the performance is very bad.
So I attached my EA and I hope someone can pointing my problems.

My EA entry rules
#1 - Previous daily candle close with OPEN PRICE below CLOSE PRICE (BULLISH CANDLE)
A)BUY STOP place above xx pips from previous CLOSE PRICE
B)SELL STOP place below xx pips from previous OPEN PRICE

#2 - Previous daily candle close with OPEN PRICE above CLOSE PRICE (BEARISH CANDLE)
A)BUY STOP place above xx pips from previous OPEN PRICE
B)SELL STOP place below xx pips from previous CLOSE PRICE

Other simple functions
-Trailing Start/Stop (try google search but all the method I tried does not work)
-Each day only place 1 BUYSTOP and 1 SELLSTOP ONLY (but now my EA seems keep open pending order on the same day)
-Pending order expiration (Does not work even I already set in OrderSend() )

you have to consult a developer with Forex Trade knowledge. they will guide you further what coding language u prefer to develop a E A plugin.