Universal MA Cross EA - page 69

 

Dynamic stop loss and take profit

Can some friend add to this EA a dynamic STOP LOSS AND TAKE PROFIT parameter?

I mean the SL and TP will not be defined manually, but by multiples of ATR.

For example:

EMA CROSS 3 X 13

THIRD EMA 39

TAKE PROFIT and STOP LOSS: 1.25 x ATR of "X" periods (I use 120 periods for H1 time frame).

It would be very useful too some mechanism to add to take profit some pips to compensate the SPREAD in a way that, if SL = TP (atr multiplier), the profit or loss in MONEY are the SAME.

Attached are one EA that has the TP & SL multiplier and one indicator that shows the ATR in pips.

double-ema-cross-atr-targets-bb-filter-dema_atr_bb_v1.1.mq4atr_in_pips.mq4

 
Robert1:
hi can anyone tell me how to increase the profit size on this great indicator? it has alot of potential but for some reason the profit size is small for me even testing it with 1. sized lots. at an average of $75 profit. Thanks in advance.

I think this is the spread effect. When get a loss is $100 or $125?

 

Different Trailing stops added

irkm:
Hi,

I try to add to 'UniversalMACrossEAV1.3.1 - Breakeven.mq4' different method of setting SL.

I want to set Stop Loss equal to highest/lowest from x (eg. 3) previous bars. This SL should be moved again (trailing) on each next bar, during the trade.

I know some basic functions for this functionality, but I am not experienced user, so I can't find a suitable place to insert this code. I don't want to destroy current version.

Someone help?

Thanks.

I have modified latest version. Following Trailing Stops features have been added:

Trailing Stop Activation Level (not only the profit or TS but also any value),

Trailing Stop Jump Level (TS moved to the next level not after each price change but after minimum (jump level) price change),

Trailing Stop based on MA,

Trailing Stop based on Highest/Lowest of previous n bars,

Trailing Stop based on Min/Max of MA and previous n bars.

It is my first MQL program modification, so please review the code.

Version 2 with minor changes attached.

 

Atr!!!

The better way to choose TP & SL is the ATR value.

I use 1.25 ATR from 240 periods in H1 time frame with excelent results.

The rules are:

EMA CROSS 3 X 13

THRID EMA 39

Take profit and Stop Loss 1.25 x ATR 240 periods in H1

For now I have to set TP and SL manually in EA. To have not to change the value every time, I use 240 period.

To know what is the value I use the ATR IN PIPS indicator previously uploaded.

 

Atr

nylon:
The better way to choose TP & SL is the ATR value.

I use 1.25 ATR from 240 periods in H1 time frame with excelent results.

The rules are:

EMA CROSS 3 X 13

THRID EMA 39

Take profit and Stop Loss 1.25 x ATR 240 periods in H1

For now I have to set TP and SL manually in EA. To have not to change the value every time, I use 240 period.

To know what is the value I use the ATR IN PIPS indicator previously uploaded.

Do you use ATR for Trailing stop loss, or set it also as a Take Profit initially?

So, when you start your eg. BUY trade SL is 1,25 ATR "below" the price and TP is 1,25 ATR "above" the price or you put only SL?

 
irkm:
Do you use ATR for Trailing stop loss, or set it also as a Take Profit initially? So, when you start your eg. BUY trade SL is 1,25 ATR "below" the price and TP is 1,25 ATR "above" the price or you put only SL?

I use only to set ST & TP. I use 1,25 above and below, but, actually, the spread difference makes the SL>TP. If we could set ATR muliplier in the EA parameters, should use something like 1,25 to SL and 1,5 to TP... The best situation would be the EA compensates the spread.

Tried 1,25 in the last two days, from trade 13.10.2011 15:00

ok, only 2 days, but the results is very impressive:

3.13.39.D1 System | Myfxbook

 

The attached image shows this 1.25 ATR system.

It's an EURUSD chart.

The green rounded are the profitable arrows and red, the loss trades.

The objectives is represented by the ATR BANDS (1,25).

There is 6 wins and 4 losses. A good result for a MA based system in a ranging market.

Files:
 

Hi,

I have downloaded this version of the EA to try -

UniversalMACrossEAV1.3.1 - Breakeven.mq4

and copied it into the 'experts' folder of my demo MT4, but when I try to attach it to a chart I get this error-

21:52:07 Cannot open file 'C:\Program Files\MetaTrader - Alpari UK\experts\UniversalMACrossEAV1.3.1 - Breakeven.mq4' on the EURUSD,H1

plus there is a small error log -

2;76;C:\Program Files\MetaTrader - Alpari UK\experts\UniversalMACrossEAV1.3.1 - Breakeven.mq4;36:1;'stdlib.mqh' - cannot open the program file

I did some searching and found I did not have a stdlib.mqh in my experts/libraries folder, so I downloaded one from a link on this board and put it in there.

Then I restarted my MT4 but the EA is still greyed out and I am still not able to load it onto the chart.

Can anyone please tell me what else may be going wrong.

Many thanks!

 

Had you compiled the EA to ex4?? It's a basic step, but some people forget or don't know that we cannot run the .mp4, but the compiled .ex4

stevechelt:
Hi,

I have downloaded this version of the EA to try -

UniversalMACrossEAV1.3.1 - Breakeven.mq4

and copied it into the 'experts' folder of my demo MT4, but when I try to attach it to a chart I get this error-

21:52:07 Cannot open file 'C:\Program Files\MetaTrader - Alpari UK\experts\UniversalMACrossEAV1.3.1 - Breakeven.mq4' on the EURUSD,H1

plus there is a small error log -

2;76;C:\Program Files\MetaTrader - Alpari UK\experts\UniversalMACrossEAV1.3.1 - Breakeven.mq4;36:1;'stdlib.mqh' - cannot open the program file

I did some searching and found I did not have a stdlib.mqh in my experts/libraries folder, so I downloaded one from a link on this board and put it in there.

Then I restarted my MT4 but the EA is still greyed out and I am still not able to load it onto the chart.

Can anyone please tell me what else may be going wrong.

Many thanks!
 
nylon:
Had you compiled the EA to ex4?? It's a basic step, but some people forget or don't know that we cannot run the .mp4, but the compiled .ex4

Ah, I did not realise, I thought it happened automatically when they were used, if not already compiled.

However, I loaded it into MetaEditor and tried to compile it, receiving this error -

'stdlib.mqh' - cannot open the program file C:\Program Files\MetaTrader - Alpari UK\experts\UniversalMACrossEAV1-3-1-Breakeven.mq4 (36, 1)

Again it is a problem with stdlib.mqh, which IS in the correct place according to what I read earlier - experts/libraries.

Knowing I had the file and it seemed unable to find it I eventually discovered, by trial and error, that it needs to go in the experts/include folder - then the EA compiled immediately and can be attached to a chart.

Tomorrow I will play around with it on demo - what time frame is best to use it on? Or should I read the whole thread!