Download MetaTrader 5
To add comments, please log in or register
Interested in the Market activity? Come and track!
roi
11
roi 2016.02.04 08:54 

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
8028
Keith Watford 2016.02.04 10:24  
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 2016.02.04 11:05  

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
8028
Keith Watford 2016.02.04 11:57  
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 2016.02.04 12:32  

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

Keith Watford
Moderator
8028
Keith Watford 2016.02.04 12:39  

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