1 (edited by tims3057 2018-02-14 11:59:25)

Topic: Universal trailing stop - expert for MetaTrader 4

Hello all
This EA has mql source code and it  is a trailing stop EA with many trailing features.It will be great if we can have this trailing stop EA in the Forex Strategy builder so that we can use it to generate strategies..Can anyone point me in the right direction please?How to put this EA in forex strategy builder and generate strategies?Thank you

Download page: https://www.mql5.com/en/code/9530

Description:
Can run as a single Expert Advisor or a script, together with any Expert Advisor.

Depending on the variable TrailingStop, trailing may be performed using the fractals, the extremal values of bar in the past or using the specified points.

If TrailingStop is greater than 0, then trailing will be carried out with the specified points, which are defined in the variable TrailingStop. If TrailingStop is less than the minimal limit stops, trailing stops will be minimal.
If TrailingStop = 0 and Tip.Fr.or.Candl = 0, then trailing will performed using the fractals. The first corresponding fractal is used for the trailing.
If TrailingStop = 0 and Tip.Fr.or.Candl = 1, then trailing will performed using the minimal/ maximal price values of the previous candle.
If Magic = 0, then the trailing will performde on all orders with of this character, without the magic number. If the variable specified Magic magic number, respectively, will only trailing orders with the number of Magic.
If OnlyProfit = true, then trailed profit orders only.
If OnlyWithoutLoss = true, then orders trailed to the price level without loss only.
Visualization:
The screen displays information about the ongoing work of the script:

- Script settings;
- Number of orders, that processed;
- Current time
- Minimum levels of Stop (-)
- Current possible stop levels (price tags)

Tips:
The script terminates when all orders are closed. If the program is running as an ExpertAdvisor, it can be terminated manually.

Post's attachments

TrailingStopFrCn.mq4 8.43 kb, 13 downloads since 2018-02-14 

You don't have the permssions to download the attachments of this post.

Re: Universal trailing stop - expert for MetaTrader 4

I have started some developments on that topic, however the more features I add to FSB Pro the slower it calculates. Unfortunately it already reached a level where if I add more things, it will become frustratingly slow. Just compare it with the blazing speed of EA Studio. The only reason EA Studio is faster is that I started it form zero and implemented only about 10% of the backtesting capabilities (calculated by the code lines of the backtester).

Re: Universal trailing stop - expert for MetaTrader 4

Try this......  Place a 20 sma on the chart.... see what that does for a trailing stop, then have a look at 12 sma... one of those may be close to what you want.
Use the offsets to adjust.

Parabolic SAR is often used as a trailing stop.

Use a ma cross os a trailing stop

These are built in already and work quite well and do not cost calculation time..

Adding complex indicators will slow the thing tremendously and actually gain little compared to what we have already.

Developing the ideal trailing stop is something you can do with experimentation.

All you need is something that will follow the price bars and close the position when it is hit, that you can do easily with a moving average.

Re: Universal trailing stop - expert for MetaTrader 4

Thank you Popov for all the hardwork and generosity.I can understand..Only you know best.As for me I know nothing about coding that is why I asked.And please forgive me If I ask too many questions on this forum..Thank you for kind response and green pips to you Good Sir.

Popov wrote:

I have started some developments on that topic, however the more features I add to FSB Pro the slower it calculates. Unfortunately it already reached a level where if I add more things, it will become frustratingly slow. Just compare it with the blazing speed of EA Studio. The only reason EA Studio is faster is that I started it form zero and implemented only about 10% of the backtesting capabilities (calculated by the code lines of the backtester).

Re: Universal trailing stop - expert for MetaTrader 4

Thank you Blaiserboy for the kind response and tip but i didnt know that I could use parabolic SAR in Forex Strategy Builder as a trailing stop..How is it done if you dont mind me asking?And apart from the Parabolic SAR and ATR trailing stop what are the other options in the Forex Strategy builder I can use as trailing stop and how are they done?Screenshots will be much appreciated.Makes thinks clear.Thank you and green pips to you Good Sir.

Blaiserboy wrote:

Try this......  Place a 20 sma on the chart.... see what that does for a trailing stop, then have a look at 12 sma... one of those may be close to what you want.
Use the offsets to adjust.

Parabolic SAR is often used as a trailing stop.

Use a ma cross os a trailing stop

These are built in already and work quite well and do not cost calculation time..

Adding complex indicators will slow the thing tremendously and actually gain little compared to what we have already.

Developing the ideal trailing stop is something you can do with experimentation.

All you need is something that will follow the price bars and close the position when it is hit, that you can do easily with a moving average.

6 (edited by hannahis 2018-02-17 13:38:27)

Re: Universal trailing stop - expert for MetaTrader 4

Popov wrote:

I have started some developments on that topic, however the more features I add to FSB Pro the slower it calculates. Unfortunately it already reached a level where if I add more things, it will become frustratingly slow. Just compare it with the blazing speed of EA Studio. The only reason EA Studio is faster is that I started it form zero and implemented only about 10% of the backtesting capabilities (calculated by the code lines of the backtester).


Popov, you mentioned that you were thinking of developing a more powerful version called FSB Enterprise.  Is this still in your plate?

If this is...kindly consider having the ability to optimize EA based on the various combinations such as smoothing method, base price and signal method.  I seriously think that if you were to add this feature, it would make searching for profitable EA much more efficient and effective.  Currently I'm building my EA rule by rule, simply because FSB doesn't find the best optimal combinations for each rule/parameter (or it is but I didn't noticed it?).  I think finding an optimal parameters isn't difficult (honestly speaking), what made find profitable EA tedious is, finding the optimal combinations instead. 

Ever since I've started searching for the best optimal combinations, I realised a few things

1) There are so many indicators that one can use to produce profitable EA, you don't really need any particular "special" one though different indicators have their advantages and limitations.

2) There are a number of profitable parameters to use and challenge isn't about finding the "correct" parameters in order to find profitable EA, the real challenge is finding the most optimal combinations for that particular parameter for it to be profitable and the art of using different LTF rules (again with their optimal combinations too) to improve the EA performance.


Secondly for the Enterprise version, kindly consider having the ability to do tick back testing, which is very essential for 1 min time chart Strategies.

As for higher time chart, (I'm not sure what's the current method being used but) is it possible that the back tester utilize the 1min data bar instead.  For example, if I were to use a H1 Time chart, then instead of relying on H1 historical data for back testing, is it possible to use 1min's data bar?  Won't this method be more accurate to "track" price movements within the H1 data bar?  Otherwise, how does the software know when I entered at a certain price level, whether the price has moved to the lowest price 1st before it move to the highest price, or whether it was there other way round, whereby it moved to the highest price 1st before it moved to the lowest price?  Since I don't know how the backtester work, I won't know how you reconcile with such price movement to ensure that the backtester produced a more accurate calculation of how the EA would otherwise perform in a real live market.  I believe you definitely has resolved this issue...I'm just curious how it is done.

Lastly, if you do intend to develop such a powerful software, if there any targeted date you planned to complete and put this software in the market for purchase?

Re: Universal trailing stop - expert for MetaTrader 4

A trailing stop tracks the price at a distance, what ever we set as the trailing stop. A moving average will do the same thing.

To see what I mean. open MT4 and place a moving average on the chart, use 12 and see what that does and then use 20 to see what that does..... they follow the price up and down the chart. and when price drops to them.......... the trade is closed.....

PSar is the same thing, it follows price.... put it on a charty and see what happens... when the trend shifts, the PSAR shifts....

Best for you to actually experiment on your own rather than me putting pics in here.

You can also use any of the indicators already in the program......

Believe me, this does not have to be complex stuff.

What do you use for your manual trading? I use both LOCTrailing and LOCTrailingMa, these are simple ea's that work quite well.

Re: Universal trailing stop - expert for MetaTrader 4

It is a requirement to advance in automated trading that you have a basic understanding of programming and C and C++.

Unfortunately FSBPro is never going to be able to incorporate everything that people want, people will have to modify the ea's from time to time to add their specific requirements.

For example, the coding that you want for trailing stops can be easily added to the ea's and then optimized on MT4 or MT5.

C is not that difficult, C++ has more features. There are free versions of each on the web. You can decide on your future with automated trading, I strongly urge that you develop a bit of skill with coding.

Study also the construction of the FSBPro Indicators as you may want to modify some of them. There is information on the site as to how to do that.

As an aside, there are many indicators available for MT4, I often want to have them. What I do is optimize in FSBPro until I can get a similar result. I look inside the indicators to see what they use and then create my own version using FSBPro indicators.

A friend of mine uses Neural Shell to get ideas and then codes or uses FSBPro to get the ea he wants.

Good Trading!

Re: Universal trailing stop - expert for MetaTrader 4

Thank you once again Blaiserboy for the kind response and explanations.What I mean is how do I set up these trailing stops you mentioned in the Forex Strategy Builder and then generate strategies with them.Am asking because the Forex Strategy builder doesnt have a trailing feature built in except for the ATR trailing by Footon.

I will be very glad if you can point me in the right direction.Screenshots will be very much appreciated.Thank you and green pips to you good Sir.

Blaiserboy wrote:

A trailing stop tracks the price at a distance, what ever we set as the trailing stop. A moving average will do the same thing.

To see what I mean. open MT4 and place a moving average on the chart, use 12 and see what that does and then use 20 to see what that does..... they follow the price up and down the chart. and when price drops to them.......... the trade is closed.....

PSar is the same thing, it follows price.... put it on a charty and see what happens... when the trend shifts, the PSAR shifts....

Best for you to actually experiment on your own rather than me putting pics in here.

You can also use any of the indicators already in the program......

Believe me, this does not have to be complex stuff.

What do you use for your manual trading? I use both LOCTrailing and LOCTrailingMa, these are simple ea's that work quite well.