1. Spread is often a floating value not fixed. You cannot speculate it based on a specific moment.
2. You do not need to count for spread for SL/TP. A buy is closed with a sell(vice versa), so the spread is already calculated.
I think OP confusing why the distance between SL and TP not 100 points like distance var value.
Yes that's confusing me because the value is different between iSpread and ask - bid price. Thanks for letting me know this been dealing with this problem for days.
You do not need to count for spread for SL/TP. A buy is closed with a sell(vice versa), so the spread is already calculated.
I tried to do calculation using bid price and ask price.
double sl = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_BID) - distance * _Point, Digits()); double tp = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_BID) + distance * _Point, Digits());
If I use this calculation the result would be like this
2024.02.23 09:39:59.675 Test (GBPUSD,M15) sl distance: 0.00111
2024.02.23 09:39:59.675 Test (GBPUSD,M15) tp distance: 0.00089
but if I use this calculation the result is like what I want
double sl = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_ASK) - distance * _Point, Digits()); double tp = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_ASK) + distance * _Point, Digits());
2024.02.23 09:41:03.733 Test (GBPUSD,M15) sl distance: 0.001
2024.02.23 09:41:03.733 Test (GBPUSD,M15) tp distance: 0.001
your calculation is correct in the distance but in reality it different. If you buy at the ask you already pay the spread in the front so use bid price in calculating the sl and tp price. If you sell you pay the spread at the end when you close it so use ask price as to calculate sl and tp price.
My understanding is that spread is paid when the close price use ask and the reason is that candle bar use bid price. When we open short position we buy at the bid price which is the price that chart shows and close short at the ask price which is bid+spread price. That's why I said that short position paid the spread at the close or end of the trade.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I wan to ask about buy and sell or entry price. I've heard about the word 'buy at the ask and sell at the bid' but there's no one talking about spread. Using the code below I want to know which one is correct between adding spread or not.
the return value that I got from the code is like this
2024.02.22 16:00:26.218 Test (AUDCAD,M15) sl distance: 0.00102
2024.02.22 16:00:26.218 Test (AUDCAD,M15) tp distance: 0.00098
2024.02.22 16:00:45.099 Test (AUDCAD,M15) sl distance (w/o spread): 0.00122
2024.02.22 16:00:45.099 Test (AUDCAD,M15) tp distance(w/o spread): 0.00078
Clearly the one using spread closer to initial distance which is 100 points but still there's a 2 points different from the initial value. Where this 2 points differrent coming from?