Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
I need an MQ4 programmer to help me out with this. I am trying to write a good trailing stop expert with some specific features.
1. A starting stop for when the Expert is started.
2. A trailing stop, adjustable from 5 pips upwards
3. A take profit function
4. Profit trailing. If true it will monitor and adjust all trades that are in profit, if false it wil lonly modify the chart it is attached to.
5. Play Expert sounud when adjustment is made.
Here are my inputs. If someone can program this for me I'd really appreciate it. Also, I'm sure many members of this forum would find it useful.
extern bool AllPositions = false; // (True To modify all positions ) False(modify chart positions)
extern int StopLoss=15;
extern int TrailingStop=10;
extern int TakeProfit=0;
extern bool ProfitTrailing = True; //(To Trail only postions on profit not loss )
extern bool UseSound = True;
extern string NameFileSound = "expert.wav";
I haven't found any way to trail a stop other than by calling OrderModify() and specifying a new value for the stoploss parameter. Using that method, the EA has to monitor each incoming tick and decide whether or not to raise (or lower) the stop.
If you don't want your broker to know where your stops are, then instead of setting a stop and trailing it, your EA will have to monitor the exchange rate and call OrderClose() when its internal stop is reached. However, that entails the risk of having no stop if the connection between the EA and the broker is lost.
I know that some brokers allow you to set a server-side trailing stop manually, and if anyone knows how an Expert Advisor can do that, please post the method for doing that.
To modify all trades, do the standard bit of code:
PHP Code:
for (int count= 0; count < OrdersTotal(); count++) {
if (OrderSelect(count, SELECT_BY_POS) == false)
TrailingStop();
}
}
The main difference is that I didn't check for magic number or currency. To restrict the functionality, check for those two things. See any EA for an example of those.
I am still working on that trailing stop project, but I'm calling it "ExitGuru" and am going to charge $20 for a compiled copy, $100 for source, or $30/hour for integration into another EA (which would allow for backtesting and less system overhead pulling down two copies of the same quote.)
I should have it finished in a week or two, I'm stuck in the middle of three EA. I have most of the functionality you want finished already. It seems like you are asking for something very simple though so you wouldn't need the EA I was writing.
The main problem I'm having is making the EA work only on the chart that it is attached to. Can someone give me the code and some instructions? I guess I need an if statemement.
I can already modify/close all trades. That part is easy. Just telling it to modify the symbol that it's attached to that's go me confused.
am going to charge $20 for a compiled copy, $100 for source, or $30/hour for integration into another EA (which would allow for backtesting and less system overhead pulling down two copies of the same quote.)
Wow! Is this ish for real? :| I wish you a nice holiday-sale season then..
Cheers,
Diam0nd
I LOVE
__________________
- MetaTrader v4.00 Build 225 (10 Jul 2008)
- MetaTrader MultiTerminal v4.00 Build 213 (20 Mar 2008)
- Always use the latest (^ABOVE^) MetaQuotes products, saves a lot of nerves. What's new.
"METAQUOTES FOR LIFE!"
The main problem I'm having is making the EA work only on the chart that it is attached to. Can someone give me the code and some instructions? I guess I need an if statemement.
I can already modify/close all trades. That part is easy. Just telling it to modify the symbol that it's attached to that's go me confused.
I've been working on that very thing in the exit strategy EA. It is easy to do it for a single static value, but hard to manage it well dynamically. Every dynamic way has a flaw.
If you look on the MQL4.com documentation, they show the code to look for a profit >0. Change 0 to some other number.