View attachment 18958
If possible I would like to modify this so that the candle on the right shows an en engulfing candle as well.
Please post the code from the related study so we can look at it. Otherwise, it's hard to know what is wrong or what needs to be fixed.
View attachment 18959
I cant get any other code except this.
For some reason it doesn't show up in the study section for you to view the code.
for some reason it doesnt show up so that I can view the source code. I cant search for the indicator but I can only select it.if you don't know where to look for the study code, there is no point in altering a code for you. you need to do some studying.
why are you looking at a web page? are you using a built in study? what is the name?
regarding post1, we don't know what candle you are talking about,
candle on the right... right of what?
if the purple arrow is pointing at an engulfing candle, then it must be based on body size and have to be bigger than the previous one.
maybe the other candle has a top level equal to other candle , instead of greather than?
From what I can tell from this screenshot and your screenshot of the parameters, it looks like you're trying to use the "Engulfing" candlestick pattern that's built into TOS. If you right-click and select "view" on that study, you'll see this:View attachment 18958
If possible I would like to modify this so that the candle on the right shows an en engulfing candle as well.
def BodyMax = Max(open, close);
def BodyMin = Min(open, close);
def IsEngulfing = BodyMax > BodyMax[1] and
BodyMin < BodyMin[1];
def IsWhite = open < close;
def IsBlack = open > close;
def IsPrevDoji = IsDoji(length)[1];
plot Bearish = IsAscending(close, trendSetup)[1] and
(IsWhite[1] or IsPrevDoji) and
IsBlack and
IsEngulfing;
plot Bullish = IsDescending(close, trendSetup)[1] and
(IsBlack[1] or IsPrevDoji) and
IsWhite and
IsEngulfing;
From what I can tell from this screenshot and your screenshot of the parameters, it looks like you're trying to use the "Engulfing" candlestick pattern that's built into TOS. If you right-click and select "view" on that study, you'll see this:
Code:def BodyMax = Max(open, close); def BodyMin = Min(open, close); def IsEngulfing = BodyMax > BodyMax[1] and BodyMin < BodyMin[1]; def IsWhite = open < close; def IsBlack = open > close; def IsPrevDoji = IsDoji(length)[1]; plot Bearish = IsAscending(close, trendSetup)[1] and (IsWhite[1] or IsPrevDoji) and IsBlack and IsEngulfing; plot Bullish = IsDescending(close, trendSetup)[1] and (IsBlack[1] or IsPrevDoji) and IsWhite and IsEngulfing;
If you look at the definition of the IsEngulfing parameter, it requires a bearish engulfing candle to have an open greater than the open of the previous candle, and a close lower than the previous close.
Your screenshot is very zoomed in so I can't tell for sure but it looks like the open of the engulfing candle that you want is lower than the open of the candle before it, which is why it's not getting flagged here. If you wanted to fix this, you'd have to copy the code in the study and adjust it yourself or look at some of the existing studies on this website that detect engulfing candles.
If possible I would like to modify this so that the candle on the right shows an en engulfing candle as well.
# pattern_engulfing_code_01
# add a pattern to a chart
# Patterns button
# .select patterns
# ..candlestick tab
# ...pick a pattern to apply to a chart (engulfing)
# pattern - engulfing code
# TD Ameritrade IP Company, Inc. (c) 2011-2023
#
#wizard plots
#wizard text: Inputs: length:
#wizard input: length
#wizard text: trend setup:
#wizard input: trendSetup
input length = 20;
input trendSetup = 3;
def BodyMax = Max(open, close);
def BodyMin = Min(open, close);
def IsEngulfing = BodyMax > BodyMax[1] and BodyMin < BodyMin[1];
def IsEngulfing2 = BodyMax >= BodyMax[1] and BodyMin <= BodyMin[1];
def IsWhite = open < close;
def IsBlack = open > close;
def IsPrevDoji = IsDoji(length)[1];
input engulfed_bars_have_to_be_smaller = no;
def engulf2 = if engulfed_bars_have_to_be_smaller then IsEngulfing else IsEngulfing2;
input use_rising_falling = no;
def rising = if use_rising_falling then IsAscending(close, trendSetup)[0] else 1;
def falling = if use_rising_falling then IsDescending(close, trendSetup)[0] else 1;
input use_white_black = no;
def white1 = if use_white_black then iswhite else 1;
def black1 = if use_white_black then isblack else 1;
input use_PrevDoji = no;
def PrevDoji = if use_PrevDoji then IsPrevDoji else 1;
#plot Bearish = IsAscending(close, trendSetup)[1] and
# (IsWhite[1] or IsPrevDoji) and
# IsBlack and
# IsEngulfing;
#plot Bullish = IsDescending(close, trendSetup)[1] and
# (IsBlack[1] or IsPrevDoji) and
# IsWhite and
# IsEngulfing;
plot Bearish = rising[1] and
(White1[1] or PrevDoji) and
Black1 and
Engulf2;
plot Bullish = falling[1] and
(Black1[1] or PrevDoji) and
White1 and
Engulf2;
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(GetColor(1));
Bearish.SetLineWeight(2);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(GetColor(2));
Bullish.SetLineWeight(2);
addchartbubble(0, high*1.002,
BodyMax + "\n" +
BodyMin + "\n" +
IsEngulfing
, color.yellow, yes);
#
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
D | Reverse Engulfing Indicator | Questions | 5 | |
A | Engulfing Candle Scan | Questions | 1 | |
T | Engulfing Bars | Questions | 18 | |
K | Multi-bar Engulfing Pattern | Questions | 21 | |
S | Cumulative Tick Indicator | Questions | 0 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.