Download MetaTrader 5

Trailing Stop with Commission

To add comments, please log in or register
roi
11
roi  

Hi,

I have a problem,

my broker use commissions, when I use in my EA trail stop it close the trade without profit finaly because it from Open price to close price standpoint its ok  but than

the commission is not included and the net trade is loss.

how can I tell the EA only if net pips is more than X pips start trail,

 

thanks

Roi 

Keith Watford
Moderator
9641
Keith Watford  
Don't start the trailing stop until it is x pips in profit the x being the amount of pips for the TS plus an allowance in pips that will cover the commission.
roi
11
roi  

so you mean, I'll check (for BUY order for example)  if  OrderProfit() > = 0 and (OrderOpenPrice - TrailStop) > Bid 

than if yes , I'll  start trail?

Keith Watford
Moderator
9641
Keith Watford  
roi_:

so you mean, I'll check (for BUY order for example)  if  OrderProfit() > = 0 and (OrderOpenPrice - TrailStop) > Bid 

than if yes , I'll  start trail?

No, for a buy

if(OrderClosePrice()-OrderOpenPrice()>=TrailStop+allowance for commisison) 

roi
11
roi  

OrderClosePrice() can't be because it still running, you mean Bid?

Keith Watford
Moderator
9641
Keith Watford  

OrderClosePrice()  is the most recent price for the order, for a Buy, it will be Bid, for a Sell, Ask.

Same as Close[0], The 0 bar has not closed yet, but Close[0] holds the most recent price. 

To add comments, please log in or register