Trailing Stop Needed For EA

To add comments, please log in or register
martin eshleman
293
martin eshleman  

I'm sure this might sound like an easy task for a lot of people here but I really have no programming experience. All I need is a working trailing stop input added to this "TimeEntry" EA. Maybe it could have an input to either have the trailing stop on or off. And if set to on, then another input for the trailing stop amount. I don't need anything else changed or deleted. If anyone could add this for me or teach me how I would really appreciate it. Thanks!

Files:
faizalperu
8
faizalperu  
meshleman3:
I'm sure this might sound like an easy task for a lot of people here but I really have no programming experience. All I need is a working trailing stop input added to this "TimeEntry" EA. Maybe it could have an input to either have the trailing stop on or off. And if set to on, then another input for the trailing stop amount. I don't need anything else changed or deleted. If anyone could add this for me or teach me how I would really appreciate it. Thanks!

here it is, just wanna help.....i hope you like it

Files:
martin eshleman
293
martin eshleman  

faizalperu, Thanks a lot! It is exactly what I wanted. And it was done so fast too. All I need to do now is test it but I'm sure it will work just fine. Thank you.

escape
141
escape  

extern double lTrailingStop = 20;

extern double sTrailingStop = 10;

void TrailingPositionsBuy(int trailingStop) {

for (int i=0; i<OrdersTotal(); i++) {

if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {

if (OrderSymbol()==Symbol()) {

if (OrderType()==OP_BUY) {

if (Bid-OrderOpenPrice()>trailingStop*Point) {

if (OrderStopLoss()<Bid-trailingStop*Point)

ModifyStopLoss(Bid-trailingStop*Point);

}

}

}

}

}

}

void TrailingPositionsSell(int trailingStop) {

for (int i=0; i<OrdersTotal(); i++) {

if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {

if (OrderSymbol()==Symbol()) {

if (OrderType()==OP_SELL) {

if (OrderOpenPrice()-Ask>trailingStop*Point) {

if (OrderStopLoss()>Ask+trailingStop*Point ||

maybe work well

kevin cherry
124
kevin cherry  

Here is the trail Ea most traders like as it has 1 pip breakeven function for tight manual trading.

Files:
martin eshleman
293
martin eshleman  

Thanks everyone for your help. People in this forum are great!

martin eshleman
293
martin eshleman  

I have tested this TimeEntry_V1 EA and it works good. However, for some reason it does not always enter the orders at the time that is input. I am assuming that it is probably because of the misspelling, "Shor" instead of "short" in the user inputs. Also, the EA doesn't enter orders correctly unless the EA is removed from the chart and reattached between orders. It seems like it can not reinitialize itself or something. Overall it is a good EA and thank you.

To add comments, please log in or register