MQL4 - automated forex trading   /  

Forum

How do Trailing Stops work and how do I code it?

Back to topics list To post a new topic, please log in or register

avatar
3
Armidinho 2008.09.09 08:42 

Hi all,



I've successfully written a couple EAs, the first one specific for a 4hr chart, using long EMAs and Stochastics, and the second one specific to 5min chart using Envelopes and MACD. I've tried to code a Trailing Stop and just can't get it to work anywhich way. I don't get syntax errors, but it doesn't seem to make any difference whether the code is there or not...



Please help

article

Secrets of MetaTrader 4 Client Terminal

21 way to ease the life: Latent features in MetaTrader 4 Client Terminal. Full screen; hot keys; Fast Navigation bar; minimizing windows; favorites; traffic reduction; disabling of news; symbol sets; Market Watch; templates for testing and independent charts; profiles; crosshair; electronic ruler; barwise chart paging; account history in the chart; types of pending orders; modifying of StopLoss and TakeProfit; undo deletion; chart print.


avatar
2462
phy 2008.09.09 09:19 

Basic idea is you are long, and price is greater than your stoploss + X pips, you move the stoploss up to price - X pips.

If short, and price is lower than your stoploss - X pips, move the stoploss down to price + X pips.

Now, what do you need help with?


avatar
3
Armidinho 2008.09.09 09:31 
phy wrote >>

Basic idea is you are long, and price is greater than your stoploss + X pips, you move the stoploss up to price - X pips.

If short, and price is lower than your stoploss - X pips, move the stoploss down to price + X pips.

Now, what do you need help with?

Well, I think I understand the basic concept, but I can't seem to get it to function in my EA.



I must be coding it incorrectly or in the wrong place...




Back to topics list  

To add comments, please log in or register