Download MetaTrader 5
To add comments, please log in or register
No PC at hand? Communicate with friends using your mobile phone!
polymath
182
polymath 2011.08.14 07:17 

Hi guys, 

I was thinking of using the profit or loss of the last trade as one of the conditions for buy and sell signals.  I found out a way to get the profit/loss by using this function:

AccountInfoDouble(ACCOUNT_BALANCE)

and storing it in an array with 2 locations, one to store the past account balance, and one to store the present balance. Then subtract the past account balance from the present account balance to get the profit/loss.  Afterwards, delete the past balance, move the present balance to the first location and wait for the next balance to place in the second location... and repeat the process..

It really sounds cumbersome and I was thinking if there is a function available so that the last profit/loss can be retrieved without going through the process above?

Thanks in advance!:D 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
Andrei Moraru
1147
Andrei Moraru 2011.08.14 12:01  

Read about HistoryDealGetDouble().

polymath
182
polymath 2011.08.14 18:12  
enivid:

Read about HistoryDealGetDouble().

Hi enivid,

Thanks for pointing me in the right direction!

/
To add comments, please log in or register