I am trying to develop a EA but, code is not working according to logic. (
image url)
What i'm trying to do:
If no trade exist -> 10 MA(Moving average) is greater than 20 MA -> Buy 0.1 lot with Stop loss 50 pips, Take profit 50pips -> If any trade exist -> and 10 MA is less than 20 MA -> close the order (don't want to wait for 50 pips profit or 50 pips loss).

When I am doing testing, i notice that the trade is not closing until fulfill the 50 profit or 50 pips loss.
What i'm want to do; I want to close the order if 10 MA less than 20 MA, even if it is doesn't fulfill 50 pips loss or profit.
Your help will be greatly appreciated.
if you any questions, please inbox or email me mymukul2005@yahoo.com
Thank you.