Cubesteak Central

Elder’s Safe Zone

November 1, 2006 3:30 am

I found a reference to Elder’s Safe Zone, which is a trailing stop methodology attributed to Alex Elder, the author of The Legendary Approach to Trading for a Living.  Since I’ve read his book, I was intrigued.

The reference that I found had the code for an indicator from MT3, so I recoded it for MT4.  I don’t know how useful it is yet, but I thought I would post and update it if necessary.

Here’s a snapshot:

eldersafezone.gif

Get this indicator:

MetaQuotes 4 Language File EldersSafeZone.mq4
EldersSafeZone.zip

11 Responses to “Elder’s Safe Zone”

Simon wrote a comment on November 1, 2006

Cube, what a nice indicator.

The default settings :
LookBack = 10;
StopFactor = 3;
EMALength = 13;

1) lookBack means current line based on last 10 price bars?

2) StopFactor = ?

EMA length best between 10-20.

cubesteak wrote a comment on November 1, 2006

Hi Simon,

Thanks for the kind words! I wish I could tell you more about this, but its a straight recode of the MT3, and I’m just figuring it out myself. The StopFactor is simply a multiplier that widens or tightens your stops. I wish I could comment what an optimal value of it would be, but… :)

Yes, LookBack is how far back it checks the price for. Elder used D1 charts mostly from what I can tell, so to him it was a number of days. This indicator is programmed to be # of bars back, so set it accordingly if you want to use it with other TF’s and still want days.

It took me a bit of time to figure it out, but the EMA length is what is determining if the SL paints above or below the line, and the LookBack is used for the determination of the SL value.

Hope it helps!

I’d appreciate hearing any tips or tricks you have after you’ve used it for a while… I’ll be posting what I find too…

Cheers,
CS

Brian wrote a comment on May 17, 2007

Cube,

Did the reference you found with the MT3 code also have MT3 code for any of Elder’s other indicators (specifically the Elder Impulse System)? I’ve coded the Impulse system for QuoteTracker and since following it, my trading has been very profitable. I just got started with MT4 and am looking at integrating the same Impulse system. Thanks for your help,

Brian

cubesteak wrote a comment on May 17, 2007

Hey Brian,

Unfortunately not – it was just this indicator. If it had, I would have ported those too! I love Elder’s work.

-CS

Brian wrote a comment on May 21, 2007

Cube,

I found the code for the Impulse System in e-Signal (below). Do you know how difficult it would be to convert it into MT4 code? Thanks,
Brian

code:

var myStudy1=null;
var myStudy2=null;
var myStudy3=null;

function preMain() {
setStudyTitle(”Impulse Indicator”);
setCursorLabelName(”Impulse”, 0);
setCursorLabelName(”MACDHist”,1);
setPriceStudy(true); }

function main() {

var myStudy1 = ema(13);
var myStudy2 = new macdHist(12,26,9);
var myStudy3 = ema(13);

//Impulse Up
if ((myStudy1.getValue(0) > myStudy1.getValue(-1)) && (myStudy2.getValue(0) > myStudy2.getValue(-1))) {
setPriceBarColor(Color.green);
}

//Impulse Down
else if ((myStudy1.getValue(0)

Brian wrote a comment on May 21, 2007

Code got cut off, here’s the link (just open in notepad)

http://www.forexproject.com/images/stories/impulse.efs

cubesteak wrote a comment on May 22, 2007

Shouldn’t be too hard. I’ll take a look!

-CS

Brian wrote a comment on May 22, 2007

Thanks!

Brian wrote a comment on May 24, 2007

Any luck?

Anonymous wrote a comment on February 4, 2009

boy this piece of code is leaky…

cubesteak wrote a comment on March 31, 2009

Yeah, probably is. Didn’t look at basic programming structure, etc. just did a source code change… Sorry for any inconvenience…

Care to comment?