MT4 Proffit EA

 

Ok so I have looked in your forums and cant find what i need.

I am a VB.Net coder and cant get what I did to work. 

How do I get an Alert EA that will do the following:

extern double  profitToAlert  = 20;

If sum of all open trades equals or is more than profitToAlert  then alert me by playing an mp3 file else do nothing.

Sum of trades profit or loss

Image shows the trades tab on MT4 the total I want to target is marked in red.

if someone could assist me in pointing me to where I could find these variables in I can use I would much appreciate it.

I saw it few years ago on a side screen in meta editor but I cant find it

 

Thank you

MOX 

 
AccountBalance()
?
 

 sum all the relevant open order profits, https://docs.mql4.com/trading/orderprofit ,  then send an alert 

 

Great it worked:

 

double  AccountProfit();

extern string AudioPlus="news.wav";

.....

.....

if(AccountProfit()>=0)

      {

         PlaySound(AudioPlus);

         Sleep(3000);

      } 

 

.....

..... 

 
GREAT THANK YOU GUYS!

now it is probably a bad idea to request help on an if statement in the same post or topic ... If it is not in the correct forum or I should make new topic please kick me behind and tell me :-) 

I did a sample in VB code to give a rough idea.

 

Dim trade as string

Dim close as string

Dim accountprofit as double

 

If trade = yes and close = false then

*my current ea code should come here and after that …

If accountprofit >= 0 then

trade = no

Close = true

End if

Else

If number of open trades > 0 then

Close all open trades while playing wav file

Else

Trade = true

Close = false

End if

End if 

 

... how does on do this in MT4, I am banging my head on the floor I cant get it to work. 

 

GOT IT! ... its working perfectly, seems like if you put your mind to it you can achieve great things!
Thank you anyway ya'll.