IdeaRe: Trailing stop EA's

2
Mladen's Ema trailing stop EA

It can monitor all the symbols or just the symbol it is attached to.

If TrailAllSymbolsoption set to true it will trail all the symbols (regardless of the symbol it is attached to - you can freely jump between symbols, it will not change the way it is working), if set to false, it will trail only the symbol it is attached toIt can monitor stopLoss less EAs.

With magicNumber.from and magicNumber.to you "regulate" which magic numbers should it trail (magic number 0 are usually only manual trades, so if you include 0 it will monitor and trail manual trades along with chosen magic numbers)It can close monitored trades when certain profit is reached. When CloseWhenProfitis set to > 0, it starts "profit monitoring" and if the total profit for trades it takes care of exceeds CloseWhenProfitit will close all those tradesIt can trail trades that are "in profit" or every trade. if TrailOnlyInProfitis set to true, it will trail only those trades that are already in positive profit, otherwise it will traill all the trades
__________________________

One more new feature is the regulated with the showMessagesoption : if set to true it will show messages like those on the right lower side of the picture (as you can see you do not have to be at the chart where you symbols of interest are), otherwise messages are going to be redirected to journal tabRest of the parameters did not change and they have the same meaning as in previous version.

You can use EMAPeriod as 15 or 20 for example.

This EA should be attached to 1 chart only and it will trail all opened trades for the account for all the pairs/charts (in case you are using my settings).

CloseWhenProfit is in dollars. It is closing all the trades when profit in dollars.

EA is moving stop loss strictly according to Moving Averages indicator's line. To see this line - you can attach standard Moving Averages indicator to the chart. In case you are using my settings if this EA - thr settings of the indicator may be the following: Please note: this EA is working on closed bar.

It means the stop loss will be moved based on value of MA indicator on the previous/closed bar.You do not need to attach any indicator especially. You need it just for visuality because it is always interesting to see this stop loss line.
____________________________

EA does the job in two steps : The EA is first modifying trailing stops according to settings (it is it's primary task) and when going through the list of trades it calculates the overall profit "on the fly"If it is required, EA closes all opened orders when certain profit is reached (so if specified with CloseWhenProfit).

But, if the time that the first step was executed is longer than 15 seconds (I simply took that as an arbitrary value) then the currently overall reached profit is recalculated again (the colectProfit() function)

It is done to save execution time (for cases when a lot of trades are trailed simultaneously) but also, when a lot of them need to modify their stop losses sometimes order execution when changing stop loss can take some time, and that execution time would almost sure mean false overall profit figures. If stop losses are not changed, than it takes almost the same time as the colectProfit() function (so a call to colectProfit() would be unnecessary in that case).You can "deactivate" that "safety" by simply removing that condition, but, at the time I wrote it it seemed as a logical step to save EA execution time and to ensure EA execution with reasonable error margin.

There is no 100% error proof method (it always can occur that in the meantime data is changed) so this is just one way to make it work as close to ideal as it can
____________________________

As of closed bars : setting for the bar that is looked for EMA value that is going to be used for trailing stop is that EMAShift parameter (as you can see, I kept original parameter names from version 1), and as you see the default value is not even the first closed bar but the second one. That is not MA shifted, but the bar of EMA that is used (there is no shift in EMA calculation, moving average shift is set to 0(line 299), that shift is the last "shift" parameter used in EMA calculation (iMA(....)) I decided to leave that option so that the user can decide what EMA bar values is he going to use as trailing stops. So yes, if you decide to set it to 0, it will, do it on every tick (if the conditions are fulfilled)

Re: Trailing stop EA's

3
mrtools wrote:Mladen's Ema trailing stop EA.
Dearest MRTOOLS
I like to be first to pay you thanks for this initiate as it is much in demand
Indicator is just a tool.

Use it only if it can benefit you. Leave it if you don't know how to use it optimally.


Re: Trailing stop EA's

6
Dearest MRTOOLS
May i ask if newest "BBands stops" indicators can be used within this TS ea,with or with out code alteration ?
regards
Indicator is just a tool.

Use it only if it can benefit you. Leave it if you don't know how to use it optimally.

Re: Trailing stop EA's

8
mrtools wrote:Mntiwana, It can be used but with some code alteration.
Dearest MRTOOLS
Thanks for quick response.
so in case using/applying any one of these TS ea,a user may off the TS function within from the EA (if any other ea/s is applied or handling trades) i means how to incorporate/integrate two EA/s (one of this TS from yours and the other one that is already applied on same terminal) please explain so that user may know including me how to use in combination state.
almost both EAs will be on different charts but what about pair if pair is same on both charts,if any conflict.
regards
Indicator is just a tool.

Use it only if it can benefit you. Leave it if you don't know how to use it optimally.

Re: Trailing stop EA's

10
mrtools wrote:I f using another EA's on the same pair use a different magic number.
Dearest MRTOOLS
Sorry for bothering you continuously
when the magic number fields from/to are empty (0) if this TS ea will be handle all trades of all pairs that have no magic number
if pairs names can be added (select able) to make it more specific and unique for not conflict to any other EA
regards
Indicator is just a tool.

Use it only if it can benefit you. Leave it if you don't know how to use it optimally.


Who is online

Users browsing this forum: Ahrefs [Bot], CommonCrawl [Bot], Google Feedfetcher, Grapeshot [Bot], gringko, IBM oBot [Bot], Mendes86, Steam1, Telegram [Bot] and 34 guests