How to know the last modify price of a trade? - page 2

 

Yes, my idea is to work with SL and TP measured in pips (points). When we open a new trade (not pending order) with SL=10 pips, we think that 10 pips is the difference between open price and stop-loss price, and for that moment we are absolutely right. If the price goes in profit, we can still think that out SL is 100 pips.

And here is the problem - if I want to set new SL as a % of the current one, I will calculate my new SL as % of 10 pips (OP-SL), and if I want to do that again... how will I know what is my SL size? Now my new SL can be on the other side of OP and then if I have to calculate SL as OP-SL it will be negative. And I can't calculate SL in relation to the current market price.

All this is just an idea, a system that can be used. I know that the true SL is price level, not something like 10 pips. And I know that I can say to my EA to memorize the last Ask/Bid price in some array... which will be very tricky with these weak array functions.

But this is not the end. Let's say that MetaTrader is restarted and it has to continue it's strategy... all the information will be lost and there is no way to know what was the last modify price for any modified trade.

I had an idea to keep database of modify prices in a file, and if the EA is restarted - to get information from there. But even this is not enough - if a trade is modified manually or from another EA, there will be no data information about that event in that database file.

And obviously there is no function that knows the real last modify price of a trade (not pending order). Even in MetaTrader 4 if you look at the Report section where stops are modified - everywhere "Price" is the open price, which is kind a weird sometimes. Thank you for your answers anyway!

 
RaptorUK: The price when the order was modified is the modified price,

If the order is open, you can't modify the open price, so he can't be referring to the oop. If he's modifying the SL or TP that's not the market price, so he can't be referring to the SL or TP

Therefor my read of the OP is what was the current market price when the order was last modified. Especially since the OP referred to Bid/Ask.

 

Hmmm well I've been looking at what you are trying to ask but I think we are all a little confused about what you are asking "how will I know what is my SL size?" does not make much sense when a stop loss does not have a 'size'.

However, I will tell you what I THINK you are wanting to do. I think you are wanting to trail your stop loss so many percent behind you. The question is, "So many percent of what?".

My only suggestion is that if you are wanting to move your stoploss a certain percent then use the Bid-OrderStoploss() not OrderOpenPrice()-OrderStopLoss(). If you are 100 pips in the money and you have not moved your stop yet. You do not simply have a 10 pip stop. A 10 pip stop is generally considered a stop whereby if the market backs up 10 pips you will get out. Obviously you have a 110 pip stop. Forget the OP it's no longer important.

If this is not what you are trying to do then forget I ever was here....PipPip..Jimdandy

 

how about you modify the TP by 1 pip each time you modify, then you can calculaate how many times it was modified by how many pips difference between the current TP and the original TP, then knowing how many times it was modified, reverse your other calculations to get the original SL.

 
Same problem with me