Help! - How to make trailing stop loss take losses?
I get unwanted profit when running trailing stop loss because the code does not account for the commission and swap,
I tried the followings which don't work
require help, thanks!
Void LongTrailingStop()
int lcnt;
int ltotal = OrdersTotal();
dual BuyProfit;
for trailing stop, I use OrderModify, along with
bool OrderModify( int ticket, double price, double stoploss, double takeprofit, datetime Expiry, Colour arrow_color=CLR_NONE)
and by default the double stoploss does not take into account the Price of trading.
Stop loss which I coded Bid-(Point*TrailingStop BuyProfit) doesn't have more work.
Maybe I should ask, how do I code a trailing stop maybe not that will take into account the cost of trading when quitting losses?
From your code, it would appear that you presume OrderProfit() has just one point unit price.
OrderProfit() does not equal to Bid-OrderOpenPrice(). If OrderProfit() return a value of 1, then it does not mean your profit is 1 point.
OrderProfit() depends on your lot size, calculated as follows:
1 pips = 10 point = $10
for buy order, OrderProfit() = lotsize*(Bid-OrderOpenPrice)/(10*point)*$10