Download MetaTrader 5

How to get the stoploss of the previous order?

To add comments, please log in or register
Diane Minshew
351
Diane Minshew 2015.02.10 23:24 
Some parts of my EA require validation of a previous price level. The best way I can think of is getting the last order in history and check the stop loss but there is no option for getting the stop loss of the last order in history.
Rodrigo Malacarne
Moderator
9949
Rodrigo Malacarne 2015.02.11 10:34  
wehsnim:
Some parts of my EA require validation of a previous price level. The best way I can think of is getting the last order in history and check the stop loss but there is no option for getting the stop loss of the last order in history.

Hello wehsnim,

You have to use the HistorySelect function, together with other functions related to history orders, like HistoryOrderGetDouble, HistoryOrderGetInteger, etc.

In your specific question, you can get the SL price of the last order by using HistoryOrderGetDouble(ticket,ORDER_SL), through a for-loop.

Regards,
Malacarne 

Diane Minshew
351
Diane Minshew 2015.02.11 15:04  
Malacarne:

Hello wehsnim,

You have to use the HistorySelect function, together with other functions related to history orders, like HistoryOrderGetDouble, HistoryOrderGetInteger, etc.

In your specific question, you can get the SL price of the last order by using HistoryOrderGetDouble(ticket,ORDER_SL), through a for-loop.

Regards,
Malacarne 

Thank you. :)
To add comments, please log in or register