Last Order type and closing type

 

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

 
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.
Reason: