ATR Trailing Stop - Help

+ New Comment
Boiseboy
Join date: 2006.03.24
Private message
#1

Hi everyone:

I have absolutely no coding experience in mq4 indicators, and am asking for help in creating an indicator. The volatility trailing stop that uses a multiple of ATR has been of great use to me in Metastock when I used to trade equities, and I've been looking for an equivalent in metatrader.

I've been using Igorad's EXCELLENT indicator VoltyChannel_Stop lately - found in this post:

https://www.forex-tsd.com/forum/debates-discussions/640-chandelier-exit#comment_24131

and it is truly great. However, sometimes I need to enter against the trend when I get a signal and must calculate the stop manually, because the indicator hasn't yet changed over.

So, what I'm looking for are TWO consistent lines indicating the long and short stops that sit x times ATR(y), above and below the closing price. The metastock code is this:

For Long: HHV(H - 2.5*ATR(5),10)

For Short: LLV(L + 2.5*ATR(5),10)

HHV means highest high value, LLV means lowest low value

I'd like to be able to modify the ATR setting (I'm using ATR(10) now) as well as the multiplier (I'm using 2*ATR now).

Please forgive me if this indicator has already been coded somewhere and I haven't found it - or, if I am asking too much.

Much appreciation, in advance, for everything,

Ed

PS: It looks something like this, but with an upper and lower stop line (PLEASE NOTE, THIS IS NOT MY PICTURE AND THE TEXT IS NOT ASSOCIATED WITH THIS REQUEST - Whew....) :

newdigital
Join date: 2005.09.28
Private message
#2

It's all that I have inside my computer with the name ATR.

And check ASCTrend system thread - you will find many stop loss indicators based on ART there.

Boiseboy
Join date: 2006.03.24
Private message
#3

Holy Cow, that's a lot of stuff. I'll go through them and see if there's something there that'll work.

Many thanks!

Ed

Boiseboy
Join date: 2006.03.24
Private message
#4

New Digital:

Again, thanks for uploading your ATR files. Unfortunately, none of the indicators can get me where I need to go. But, the ATR_SL_Chanel was close - but, I cannot figure out what the ATR setting is and what the input value represents.

In any event, if anyone reading this can code the description in the first post, I would be eternally grateful.

You'd get, maybe not my first born child, but probably one of the ones later on...

Ed

igorad
Join date: 2005.10.26
Private message
#5

Hi,

Try to use this indicator.

Igor

Boiseboy
Join date: 2006.03.24
Private message
#6

Igor:

I don't know how to keep thanking you for your help. I can see your generosity has no limit - and I'm sure I speak for many, many people on these forums.

This stop indicator is great; it is similar, I think, to the volatility stop (your volty_channelstop v1) I was using. I can't seem to figure out the difference, though I know one exists. They don't exactly match up even when I've make the settings equivalent.

Again, I really appreciate all your help, now, in the past, and certainly in the future (when you'll finally tire of me...).

Ed

newdigital
Join date: 2005.09.28
Private message
#7

May be this one?

I am not sure ...

igorad
Join date: 2005.10.26
Private message
#8

Hi BoiseBoy,

Thanks for good words.

I've tried use your Stops formulas with small improvements.

Igor

Boiseboy
Join date: 2006.03.24
Private message
#9

A Very Public Thanks

NewDigital and Igorad:

I think I've now got everything I need to do my backtesting.

You two are great examples of people who will go out of their way to help somebody they don't even know, when they get nothing in return short of appreciation (if they are lucky).

If I ever get this trading figured out so I'm consistently profitable, I'll have people like you to thank. They say one can only get to the top by standing on the shoulders of others, and the two of you are prime examples of very broad shoulders.

Thanks again,

Ed

DanielTyrkiel
Join date: 2005.11.21
Private message
#10

I appreciate you've started this thread, and of course the invaluable help of Igor and Newdigital. I've started looking at one of the ATR SL indicators for my own style of trading. Very helpful my friends, thank you all.

igorad
Join date: 2005.10.26
Private message
#11

Hi,

I've fixed small bug in inputs (double instead int for Kv).

Igor

deeforex
Join date: 2005.10.06
Private message
#12

thanks Igorad!!!!

Adyandy
Join date: 2006.09.25
Private message
#13

@

Kan somebody translate this cmc codec into metratrader 4 codec for me?

it is a automatic system!

Code;

Atr =AverageTrueRange[50](close)

keyofday=(high + low +close)/3

buyeasierday =1

selleasierday=1

if (close> keyofday) then

selleasierday =0

endif

if(close<=keyofday)then

buyeasierday =0

endif

if (buyeasierday =1) then

longEntryPoint=open +atr*0.0

shortEntryPoint=open-atr*0.5

endif

if ( selleasierday =1) then

longEntryPoint=open +atr*0.5

shortEntryPoint=open-atr*0.0

endif

//LongEntry

if close>= longEntryPoint and not longonmarket then

buy 10000 shares at longEntryPoint stop realtime

elsif not longonmarket then

endif

longliqpoint=entryquote-3*atr

//LongExit

if close

sell at longliqpoint stop realtime

endif

//ShortEntry

if close<=shortEntryPoint and not Shortonmarket then

sellshort 10000 shares at shortEntryPoint stop realtime

elsif not shortonmarket then

endif

shortliqpoint=entryquote+3*atr

//ShortExit

if close >=shortliqpoint and Shortonmarket then

exitshort at shortliqpoint stop realtime

endif

Indikatorcode;

atr=AverageTrueRange[50](close)

keyofday=(high + low +close)/3

buyeasierday =1

selleasierday=1

if (close> keyofday) then

selleasierday =0

endif

if(close<=keyofday)then

buyeasierday =0

endif

if (buyeasierday =1) then

longEntryPoint=open +atr*0.0

shortEntryPoint=open-atr*0.5

endif

if ( selleasierday =1) then

longEntryPoint=open +atr*0.5

shortEntryPoint=open-atr*0.0

endif

return longEntryPoint as "Long",shortEntryPoint as"Short"

Maji
Join date: 2006.03.03
Private message
#14

I think it is useless to do the buy/sell easier calcs if you are going to use this:

if (buyeasierday =1) then

longEntryPoint=open +atr*0.0

shortEntryPoint=open-atr*0.5

endif

if ( selleasierday =1) then

longEntryPoint=open +atr*0.5

shortEntryPoint=open-atr*0.0

endif

What difference does it make?

This is a plain vanilla volatility expansion/breakout system.

Adyandy
Join date: 2006.09.25
Private message
#15

Hello Maji,

As well (and which for one) that system is not points I is so exact not from me developed, I have only bit changed and tested with the baking test of CMC and the result well out too well and was to be that because of wants I with the MT4 program to also test. Can you help me ?

Greeting.