Download MetaTrader 5

Easier way to know if last trade was profitable...

To add comments, please log in or register
polymath
182
polymath  

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
Andriy Moraru
1259
Andriy Moraru  

Read about HistoryDealGetDouble().

polymath
182
polymath  
enivid:

Read about HistoryDealGetDouble().

Hi enivid,

Thanks for pointing me in the right direction!

To add comments, please log in or register