How to stop expert adviser from trading, when profit is made

 
Hi I have written a code for auto trade in Expert Adviser. My autotrade work fine. it open trade and close trade.
My problem is, when a buy / sell position is closed. The EA automatically open another position in fewminitues, or in few hours time. That cause me to lost a lot of money, as the EA trade too frequently and too unecessary.

How to I stop the EA from executing buy & sell order, when I have made my profit for the day.
I have use the Sleep(1440000) command, but it doestn't work at all.
Example, if I have already made 50 pips profit for the day. I want to stop the EA from trading further.

As I cannot monitor the system 24 hrs a day, thus I written a automation program.
I do expect some command to stop the EA from executing trade, once the profit is made for the day.

francis
 
Hi I have written a code for auto trade in Expert Adviser. My autotrade work fine. it open trade and close trade.
My problem is, when a buy / sell position is closed. The EA automatically open another position in fewminitues, or in few hours time. That cause me to lost a lot of money, as the EA trade too frequently and too unecessary.

How to I stop the EA from executing buy & sell order, when I have made my profit for the day.
I have use the Sleep(1440000) command, but it doestn't work at all.
Example, if I have already made 50 pips profit for the day. I want to stop the EA from trading further.

As I cannot monitor the system 24 hrs a day, thus I written a automation program.
I do expect some command to stop the EA from executing trade, once the profit is made for the day.

francis


Why not use the OrderProfit() function to find your profitability and make it a condition to the OrderSend() function?
-charliev
Reason: