CCI EA problems Needs code fixed

 

Hi...A friend coded this CCI EA for me, but it has problems. It won't follow the rules all the time. Here's the rule for placing trades: EA places a buy in after it has cross a point coming up from below. IE, CCI is at -150 and moving up. And target point is -50. As the EA moves up from -150 and crosses -50 the buy condition would be meant. Just the opposite for sell. It won't place the BreakEven and Trailing Stop on IBFX most of the time either. The TradeBar is set at 2. My problem with the trade_bar is that it will place a trade whatever it is set at after the signal no matter what the bars are. I need to get this changed so that it will put in the trade only if the bars are of the same polarity.....positive or negative meaning that all bars have to be above the signal for a buy and below for a sell. If someone could check the EA and make the code stronger that would be awesome. Thanks Marty

Files:
Reason: