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
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.
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
Here is the trail Ea most traders like as it has 1 pip breakeven function for tight manual trading.
Thanks everyone for your help. People in this forum are great!
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.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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!