Download MetaTrader 5

Last Order type and closing type

To add comments, please log in or register
Have you developed a profitable strategy? Share it with millions of traders via Signals!
Egils
5
Egils 2014.02.01 20:06 

Hello!


I need help with my expert advisor.

I want to detect wether previos trade was stoped out by stop loss and what was the opening type (BUY or SELL) of previous order.

I need this becaus i don't want to open new trade immidiatly after previous trade was stoped by sl.


thanx

Simon Gniadkowski
Moderator
18000
Simon Gniadkowski 2014.02.01 20:23  
LatvianFX:

Hello!


I need help with my expert advisor.

I want to detect wether previos trade was stoped out by stop loss and what was the opening type (BUY or SELL) of previous order.

I need this becaus i don't want to open new trade immidiatly after previous trade was stoped by sl.

Loop through the trades in the history, select them one by one, check their OrderCloseTime() to find the most recent, once you have the most recent find it's type using Ordertype() and then check it's OrderClosePrice() and compare it against it's OrderStopLoss() to try and determine it was closed by SL.
To add comments, please log in or register