t/p is not working properly - page 3

 
angevoyageur:

What is closing a SELL trade ? It's a BUY! So this BUY is taken at ask price, which ask price ?


I know that short trades are closed using the ASK price, but is the TP triggered by the ASK price? The price you see on the chart is the BID price, and I thought that is what triggered the TP... am I wrong?
 
RaptorUK:

Nope,  this isn't correct.  Take a hypothetical example where a trade is opened and then immediately closed,  the loss is due to the spread.  Using your calculation above for the SELL  Profit = Open price - Close price = BID_OPEN  - BID_OPEN + 0 = 0.  but this is not the correct answer because the Spread has to be paid. 

It should be this . . .  Profit = Open price - Close price = BID_OPEN  - ASK_OPEN + 0 = -Spread.  . . . .  but this assumes that the Spread is the same from the open time to the close time.

You mixed different things. The calculation I provided is when the trade is closed at TP (100 pips in the example). You can't set a TP inside the spread (at opening of the trade), so in your example the trade can't be closed by a TP order.

Obviously, in your hypothesis, you lost the spread. No problem with that.

 
alladir:

I know that short trades are closed using the ASK price, but is the TP triggered by the ASK price? The price you see on the chart is the BID price, and I thought that is what triggered the TP... am I wrong?
Yes, check it
 
angevoyageur:
Yes, check it


I will, on Monday:D  wow, I was having such problems writing my algorithms.... this makes like so much easier then.. hehe
 
alladir:


No, this is still not right.

for short orders, the spread is taken when the order is CLOSED, not before, so using OrderOpenPrice  still gives a profit of:   100 pips minus spread at time of closing.          SHORT TRADES ARE OPENED AT BID     SHORT TRADES WILL BE CLOSED AT ASK    so the spread is taken with that automatically

 

Getting a TP of 100 pips for long orders is easy.

For short orders, you have to make the TP as OrderOpenPrice + 100 pips + spread      ERROR 130   -

(and hope that the spread is near constant). 


foolish what you write here.....

your absolutely wrong ....

it begins with the way you place your trades

If you open Sell at 1.35000(5 digit broker) then your TP price is with 100 pips  1.34000  so modify   OrderOpenPrice() - 100 pips     don't use spread here 

when the OrderClosePrice() reach 1.34000 your trade will be closed   Spread is allready calculated inside  OrderClosePrice()

Opening at Bid and using Bid with modifying will fail because in the betweentime from opening and modifying the Bid price can have been changed 

 
deVries:


foolish what you write here.....

your absolutely wrong ....

it begins with the way you place your trades

If you open Sell at 1.35000(5 digit broker) then your TP price is with 100 pips  1.34000  so modify   OrderOpenPrice() - 100 pips     don't use spread here 

when the OrderClosePrice() reach 1.34000 your trade will be closed   Spread is allready calculated inside  OrderClosePrice()

 


Yes.... as already stated, I know all this. As already stated..... I thought that TP's were triggered by the price you see on the chart (i.e. the BID price).... not by the ASK price.

Do you understand my mistake? Actually it's no foolish at all, just inexperienced. 

I will check this on Monday and get back to you... probably with an apology.

 
alladir:


Yes.... as already stated, I know all this. As already stated..... I thought that TP's were triggered by the price you see on the chart (i.e. the BID price).... not by the ASK price.

Do you understand my mistake? Actually it's no foolish at all, just inexperienced. 

I will check this on Monday and get back to you... probably with an apology.


sorry i called it foolish it was not to harm you ......   but had no other word to express it that clear your wrong
the moment i replied i had to think how to write a good explanation you would understand where your thinking was wrong

that took some time for me in between there were some good reply's from angevoyageur i didn't read before my posting was done

keep on learning i do also....   

 
alladir:


..... I thought that TP's were triggered by the price you see on the chart (i.e. the BID price).... not by the ASK price.

Do you understand my mistake? 

On a sell trade (OP_SELL), the TP is triggered by the ASK price.  Conversely, on a buy trade (OP_BUY), the TP is triggered by the BID price.  Remember: buy the Ask and sell the Bid.  Every forex transaction has two legs: (1) the entry and (2) the liquidation.  For example, if you put in a buy trade at 1.35000 with a stoploss at 1.34000 and takeprofit at 1.36000, the first leg of the transaction (entry) uses the Ask price, and the second leg of the transaction (liquidation) is therefore triggered using the Bid price.  So, if your entry is a buy (at Ask), then your liquidation must be a sell (at Bid).  And, if your entry is a sell (at Bid), then your liquidation must be a buy (at Ask).

 
"krishna_gopal_2:

 

235 2009.12.17 02:02 t/p 104 0.10 1.4460 0.0000 1.4460 -5.04 21437.31

239 2010.01.04 01:44 t/p 121 0.10 1.4257 0.0000 1.4257 87.52 21508.51

305 2010.08.06 14:08 t/p 153 0.10 1.3330 0.0000 1.3330 132.01 24169.06

Why is it happening? Thanks in advance. 

-Krishna. "

Can anyone differentiate these three thing. What happened there exactly. I understood that (after reading the replies) spread eats small amount of the profit (and it doesn't a serious matter). But -5.04 is a serious one.

 

Actually the SELL orders aren't losing the spread like I originally said. I was wrong there, as many people stated afterwards

Besides that, you're not giving enough information to answer the problem. What do those figures stand for? I don't know what they are. I suspect even knowing that won't be enough

Did you write this EA? You need to add code to find out why it is opening and closing each trade.. it shouldn't be too hard to do. There are no major flaws in the code you posted. The problems are in what you didn't paste and there's no way we can guess those problems.

Reason: