Please help with a little problem in my ea

Hello,

I have coded a simple ea that enters on a cross of mas (5wma and 25ema) when the macd lines are correct. I am having a problem with gettin bad entrances like the one highlighted on the screen shot below. It is entering when the mas don't quite cross. Any advise as to what i am doing wrong? I can upload the code if needed.

Thanks for the help

Files:
scnshot1.jpg  174 kb

how do you check the cross? you always have to check the last closed bar because MAs are lagging. they aren't fixed until a new bar was opened. maybe this can help (one of the most mistakes with MAs )

that would make sense why i am getting all of the erroneous crosses! I didn't consider that. Is there a way to check the cross with an ea?

bump bump

help please!!

Upload the entry part of the code, and I'll try to help.