Is it possible to add the spread on top of the HighLowDisplacePips parameter for sell trades?
I'm using the EA with pleasure on the 5 minute time frame, but the high spreads on some pairs take out the stop loss before I really want to.
It is already in it implicitly (by using bid and ask as a starting point for trailing stops - if it was using some other prices, the it would exclude the spread, but by using bid and ask and not some other price, the spread is included too)
Hi mladen, thanks for the quick reply.
I just checked it and when I have a sell trade open the HighLowDisplacePips is calculated from the candle high, the bid price. I would like to have the option to add the spread at the moment the candle closes on top of the HighLowDisplacePips for sell trades so I can "create" the high for the ask price. I know it's not completely accurate because the spread fluctuates, but on pairs like GBPNZD it makes a huge difference on the 5m and even 60m time frames.
Buy trades are fine as it is.
If you mean this part
double add = HighLowDisplacePips*Point*MathPow(10,Digits%2);
forWhat 1 is buy order and the other case is sell order
So, as you see, they are symmetrical (all the code is symmetrical - buy order uses bid as a basis, sell order uses ask as a basis for stop losses, and so on). You might try using negative value for HighLowDisplacePips, but there is no place where asymmetricity can happen
I'm not sure if you understand how I want it to behave, I want it to be asymmetrical.
I opened a buy and a sell trade, as you can see on the pic both stop losses are placed exactly at the high and low of candle 1. Candles are drawn based on the bid prices. You can see that the high of the open candle is a bit lower as the high of candle 1. Let's say the difference between the two highs is 1 pip and the spread is 2 pips, the result would be that the stop loss got hit because in a sell trade the stop loss gets taken out by the ask price, while the high didn't get broken.
-For sell trades place sl at high+spread(+/- displacepips)
-For buy trades place sl at low(+/- displacepips)
Here you go : high_low_trailing_stop_1.02.mq4
There is a separate displace for buy and a separate displace for sell. You can use any value for either. They do not need to be equal. They can be negative and positive. So now you can use any combination for displacement you wish
Did you check it now?
Why do you want to use asymmetric settings for buys and sells?
Maybe he is trading indices or something similar - who knows. Now it is possible to set the symmetricity (or assymetricity) so each trader can use it per will