# Include spread for SL and TP

They are already making profit from their signals. Publish your signal and join them!
321
2014.02.15 01:26

hi guys

i thought i had this correct, and now i am doubting myself.

I know we enter a buy at ask and therefore close SL and TP at bid and enter short at bid and close SL and TP at Ask.

However my entry line, SL line and TP line are calculated off the bid. I have made no allowance for spread in this calculation so the entry line, sl line and tp line for a buy trade are still at the Bid price. (TP and SL are equal distant from EL ie 1:1)

Would I be better off changing the calculation of these lines to be based at the Ask, or just include the spread in the ordersend?

(my thoughts are to accommodate this in the ordersend because otherwise if the spread changes whilst calculating each line, i could end up with a situation where the SL pips does not equal the TP pips. The difference between EL and SL go into my risk calculation for position sizing, so i need to have this correct to make sure I maintain 1:1)

at the moment the entry code is:

```///buyprice function

{
RefreshRates();
point_2 =Point/2;
}

///sellprice function
double sellprice ()
{
RefreshRates();
point_2 =Point/2;
return (Bid +point_2);
}

if ((EL()+pips2dbl) - buyprice() < Point/2) // so if Ask is greater than the (EL line + one point)

if (sellprice() - (EL()-pips2dbl) < Point/2) // so if Bid is less than (EL line - one point)
OpenSellOrder(LotSize(),SL(),TP());

/////Ordersend function

```

and the sell order does not need to have the spread at all = (SL()+pips2dbl),(TP()-pips2dbl)

Would that be more correct?

(i use pips2dbl to just give me one point - so one point above or below my TP and SL)

I have added print statments and then done the calc manually in excel using the outputs, but as i say am doubting myself.

13982
2014.02.15 01:58

For a Buy you've already paid the spread (brought at the Ask.) Set the stops relative to the bid, which is where the market is the moment the order is opened.

For a Sell, you pay the spread when you close. The stops are relative to the Ask == Bid+spread. If you set them relative to the Bid you have larger stops (the spread) on buys and smaller stops on sells.

321
2014.02.16 00:02
WHRoeder:

For a Buy you've already paid the spread (brought at the Ask.) Set the stops relative to the bid, which is where the market is the moment the order is opened.

For a Sell, you pay the spread when you close. The stops are relative to the Ask == Bid+spread. If you set them relative to the Bid you have larger stops (the spread) on buys and smaller stops on sells.

thanks WHR.

so if i have understood correctly then i need to amend as below? so only the sell trades have the spread inc for TP and SL

```// buy trade

i did a test where i placed limit orders instead of mkt orders to make sure the entry was the EL line and therefore equal distant.