pipCharlie

Chandelier Stop

A modified verion of the Chande & Kroll's Stop indicator.
즐겨찾기 스크립트에서 빼기 즐겨찾기 스크립트에 넣기
//+------------------------------------------------------------------+
//| 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)
How would you place an alert on this indicator, Trying to have one every time it changes color or direction.
+1 응답
@pipCharlie Thank you for this script. I have been using it for a while now and it has helped quite a lot. Is there a way to make this a strategy so that It can be backtested? What I would like to know is how it might work if you used as a long entry, the chandelier (first mark below the candle) and the use the chandelier as the long exit as well.
응답
pipCharlie Bremily01
@Bremily01, I've seen it done in MT4. An Expert Advisor (EA) is coded using this strategy (or any strategy for that matter) then the EA can be backtested. It would be similar for other platforms.
+1 응답
Can you make this multi timeframe? It would be very interesting to see.
+1 응답
pipCharlie GoldBowtie
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.
+1 응답
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)

+2 응답
pipCharlie ChrisMoody
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.
응답
ChrisMoody pipCharlie
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 ...
응답
pipCharlie ChrisMoody
I definitely will. Thanks again for you assistance, your generosity is greatly appreciated.
응답
ChrisMoody pipCharlie
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.
응답
홈으로 스탁 스크리너 포렉스 스크리너 크립토 스크리너 이코노믹 캘린더 사용안내 차트 특징 프라이싱 하우스룰(내부규정) 모더레이터 웹사이트 & 브로커 솔루션 위젯 차팅 솔루션 라이트웨이트 차팅 라이브러리 헬프 센터 프렌드 리퍼하기 기능 개발/개선 요청 블로그 & 뉴스 잦은물음 위키 트위터
프로화일 프로화일설정 계정 및 빌링 프렌드 리퍼하기 나의 서포트 티켓 헬프 센터 공개아이디어 팔로어 팔로잉 비밀메시지 채팅 로그아웃