pipCharlie

Chandelier Stop

A modified verion of the Chande & Kroll's Stop indicator.
Remove from Favorite Scripts Add to Favorite Scripts
//+------------------------------------------------------------------+
//| Edited original VStop Script from LazyBear using info from       |
//|                                           ChandelierStops_v1.mq4 |
//|                                  Copyright © 2006, Forex-TSD.com |
//|                         Written by IgorAD,igorad2003@yahoo.co.uk |   
//|            http://finance.groups.yahoo.com/group/TrendLaboratory |                                      
//+------------------------------------------------------------------+

study("Chandelier Stop", overlay=true)

//input variables
Length=input(title="Look Back Period", type=integer, defval=22)
ATRPeriod=input(title="ATR Period", type=integer, defval=22)
Mult=input(title="ATR Multiplier", type=integer, defval=3)

//calculate stop value
short_stop = lowest(Length)+Mult*atr(ATRPeriod)
long_stop  = highest(Length)-Mult*atr(ATRPeriod)

shortvs=na(shortvs[1]) ? short_stop : iff(close>shortvs[1], short_stop , min(short_stop,shortvs[1]))
longvs=na(longvs[1]) ? long_stop : iff(close<longvs[1], long_stop, max(long_stop,longvs[1]))

longswitch=iff (close>=shortvs[1] and close[1]<shortvs[1] , 1 ,  0)
shortswitch=iff (close<=longvs[1] and close[1]>longvs[1] ,  1 ,  0)

direction= iff(na(direction[1]), 0, 
			iff (direction[1]<=0 and longswitch, 1, 
			iff (direction[1]>=0 and shortswitch, -1, direction[1])))
			
pc=direction>0?longvs:shortvs

plot(pc, color=direction>0?aqua:fuchsia, style=circles, linewidth=2)
plot(pc, color=direction>0?aqua:fuchsia, style=line, linewidth=2)
Man....

most people don't realize the little things you add in your codes to make such attractive indicators. I LIKE how you used the circles and line...Looks sharp.

Hate to bite off your style...but I've got to use that technique!!!
Reply
pipCharlie...

Sorry man...I looked at the code and thought you were lazyBear... Still...Great work....Clean looking indicator
Reply
pipCharlie...

you may or may not care but a lot of people aren't aware of the linebr option as a plot. It gets rid of the line that connects from the True/False condition. Gives you the benefit of using a line...but not a continuous line. See chart below.

I changed the 3rd to last line that said pc=direction... to:

pcup=direction>0?longvs : na
pcdn=direction<0?shortvs : na

plot(pcup, color=aqua, style=circles, linewidth=2)
plot(pcup, color=aqua, style=linebr, linewidth=2)

plot(pcdn, color=fuchsia, style=circles, linewidth=2)
plot(pcdn, color=fuchsia, style=linebr, linewidth=2)

snapshot
Reply
pipCharlie ChrisMoody
2 years ago
AWESOME!! Thanks Chris now it looks exactly how I wanted it.
If you ever get an opportunity, I'd love to see an MTF version. I haven't learned how to do that yet.
Reply
ChrisMoody PRO pipCharlie
2 years ago
No problem...it's a lot cleaner that way.

You probably know how to do this already. But I have a similar code that Paints the bars when they change direction, ability to turn on off Long or short side, plot background highlights on the reversals...etc. I try to throw in about every option available per indicator so people can see what the capabilities are. If you want to check it out and see if there is anything you would want to use ...
CM Gann Swing High Low V2

Reply
pipCharlie ChrisMoody
2 years ago
I definitely will. Thanks again for you assistance, your generosity is greatly appreciated.
Reply
ChrisMoody PRO pipCharlie
2 years ago
No problem...it's great to see new coders. If you take a look at any of my scripts....I try to add in about every feature possible to make people aware of the current capabilities.
Reply
GoldBowtie
10 months ago
Can you make this multi timeframe? It would be very interesting to see.
Reply
pipCharlie GoldBowtie
10 months ago
I tried but I'm not much of a programmer so I was unsuccessful. I do have an MTF version for MT4 and it is quite interesting.
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out