SL/TP sometimes not work?

 

Hi

My EA use virtual tp, not hard tp/sl

Using the virtual system allow me to work as trailing, moves sl immediately to the initial tp and start trailing from there

It works and close at profit, but sometimes I notice the position in profit and close at loss

I know it maybe caused by a sudden market movement but it was normal market and normal move

is there any way to avoid this and force closing corrctly?

 

If you are trading extremely volatile instruments, like Gold, what you are experiencing is normal.

Virtual TP/SL levels are not recorded with your trades and your broker, are only active in your MetaTrader platform. When the market moves extremely fast, like Gold usually does lately, from the time the terminal sends the signal to the broker to modify or close the trade, until this command reaches the broker and it is executed, some milliseconds pass and in that time, the instrument has moved considerably, resulting in the offset of your desired TP/SL levels, due to slippage.

When you use hard TP/SL levels, these are recorded with your broker, so the distance these commands travel is almost half of what they do now and the modification of trades happens much faster.

 
samyhussein:


You could use both hard sl and hard tp together to lessen the effect when several ticks moves fast, but there is nothing you can do to avoid the times when price moves 3 pips between 2 ticks (for example).
 
Eleni Anna Branou #:

If you are trading extremely volatile instruments, like Gold, what you are experiencing is normal.

Virtual TP/SL levels are not recorded with your trades and your broker, are only active in your MetaTrader platform. When the market moves extremely fast, like Gold usually does lately, from the time the terminal sends the signal to the broker to modify or close the trade, until this command reaches the broker and it is executed, some milliseconds pass and in that time, the instrument has moved considerably, resulting in the offset of your desired TP/SL levels, due to slippage.

When you use hard TP/SL levels, these are recorded with your broker, so the distance these commands travel is almost half of what they do now and the modification of trades happens much faster.

Thank you, your reply is detailed

The issue is the normal thing the hard sl moves once the virtual tp reached, here it moves sl to behind the tp level and move it with the trailing step

My problem that sometimes this rule don't work for a reason I don't know that's why when price change fast it close at loss while it is supposed to close at profit

Here is the point I don't know why sometimes the rule don't work even it worked with other orders that closed at profit

 
samyhussein #:

Thank you, your reply is detailed

The issue is the normal thing the hard sl moves once the virtual tp reached, here it moves sl to behind the tp level and move it with the trailing step

My problem that sometimes this rule don't work for a reason I don't know that's why when price change fast it close at loss while it is supposed to close at profit

Here is the point I don't know why sometimes the rule don't work even it worked with other orders that closed at profit

This all happens due to slippage, you can't avoid that with virtual TP/SL levels.

Even hard TP/SL levels are not respected in fast moving markets.

 

Slippage is one thing.

IT could also be not adjusting for the spread. You buy at the Ask, and close at the Bid. Show your code.