Can I detect a deposit posting to the account???

 
Hello,

If I have an EA that is checking for a AccountEquity() value to close my positions, what is going to happen if I deposit more money into the account? Answer: It will close all my positions when I don't want it to!

So my question to you:

Can I detect a deposit so I can add the deposit to my equity target before comparing the equity target to the AccountEquity() again?

Thank you very much for your help on this very important issue.

-Christian
 
Your EA should analyze account history for deposit, withdrawal operations.
 
Yes, but I am not sure how to do it.

OrderType() only says:
Returns order operation type for the currently selected order. It can be any of the following values:
OP_BUY - buying position,
OP_SELL - selling position,
OP_BUYLIMIT - buy limit pending position,
OP_BUYSTOP - buy stop pending position,
OP_SELLLIMIT - sell limit pending position,
OP_SELLSTOP - sell stop pending position.

My broker tends to put the word "balance" in the Type column, "Deposit" in the Lots column, no symbol price or close times. But is this reliable? What is the best way to determine a deposit or withdrawal?

Thanks again,

Christian
 
Few weeks ago such question was discussed. "Need Help with SummaryReport.mq4"

There are code for deposit/withdrawal - 6
 
Few weeks ago such question was discussed. "Need Help with SummaryReport.mq4"

There are code for deposit/withdrawal - 6


Thank you very much, that is exactly what I was looking for.

-Christian
Reason: