• Get $40 off VIP by signing up for a free account! Sign Up

candle pattern help

mii

Member
VIP
Hi,

Wrote this coded to show the pattern shown in pic, it doesnt work.
what wrong am i doing ? pls help
used conditional wizard to create the pattern. ols check the pic as well. thank you

def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
plot PatternPlot =
IsDown[1] and
IsDown[0] and
close[1] < close[0] and
open[1] >= open[0] and
low[0] is equal to Lowest(low[0], 2);

PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
PatternPlot.SetDefaultColor(GetColor(6));
 

Attachments

  • candlepattern.png
    candlepattern.png
    2.5 KB · Views: 44
  • conditional_wizard.png
    conditional_wizard.png
    10.2 KB · Views: 43
Solution
Hi,

Wrote this coded to show the pattern shown in pic, it doesnt work.
what wrong am i doing ? pls help
used conditional wizard to create the pattern. ols check the pic as well. thank you

def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
plot PatternPlot =
IsDown[1] and
IsDown[0] and
close[1] < close[0] and
open[1] >= open[0] and
low[0] is equal to Lowest(low[0], 2);

PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
PatternPlot.SetDefaultColor(GetColor(6));


to help figure things out,
..i add a bubble to display variables.
..another thing is to simplify formulas. your plot has 5 conditions. put a # in front of a couple...
Hi,

Wrote this coded to show the pattern shown in pic, it doesnt work.
what wrong am i doing ? pls help
used conditional wizard to create the pattern. ols check the pic as well. thank you

def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
plot PatternPlot =
IsDown[1] and
IsDown[0] and
close[1] < close[0] and
open[1] >= open[0] and
low[0] is equal to Lowest(low[0], 2);

PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
PatternPlot.SetDefaultColor(GetColor(6));


to help figure things out,
..i add a bubble to display variables.
..another thing is to simplify formulas. your plot has 5 conditions. put a # in front of a couple code lines and see what happens.
..after staring at many bubbles, it seems that conditions 2,3,5 are almost never true at the same time. this might not mean anything?

def Pattern1 =
IsDown[1] and
IsDown[0] and
(close[1] < close[0]);
# and
#(open[1] >= open[0]) and
#(low[0] == Lowest(low[0], 2));



a couple of things,
..i think the plot formula is working, it just isn't true very often.
..a boolean green point is on the candle, and may be covered up. so you will probably not see most of the plots.

i added a bubble to display all plot variables, 1 or 0. if they are all true, then plot a yellow bubble.
the bubble is almost never yellow.

i added a cyan triangle , to replace the green point. it is much more noticable.


test with MO on a day chart. shows 3 yellow bubbles on the chart.


Code:
#pattern_help2

#https://usethinkscript.com/threads/candle-pattern-help.19000/
#candle pattern help

def na = double.nan;
def bn = barnumber();

#def IsUp = close > open;
def IsDown = close < open;
#def IsDoji = IsDoji();
#def avgRange = 0.05 * Average(high - low, 20);
def Pattern1 =
IsDown[1] and
IsDown[0] and
(close[1] < close[0]) and
(open[1] >= open[0]) and
(low[0] == Lowest(low[0], 2));

plot PatternPlot = if pattern1 then high*1.01 else na;
patternplot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
#PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
#PatternPlot.SetDefaultColor(GetColor(6));
PatternPlot.SetDefaultColor(Color.cyan);
patternplot.setlineweight(5);
patternplot.hidebubble();


input test1 = yes;
AddChartBubble(test1, low,
(IsDown[1] + "\n" +
 IsDown[0] + "\n" +
 (close[1] < close[0]) + "\n" +
 (open[1] >= open[0]) + "\n" +
 (low[0] == Lowest(low[0], 2)) + "\n" +
 Pattern1)
, ( if pattern1 then color.yellow else color.gray), no);
#
 

Attachments

  • img1.JPG
    img1.JPG
    55 KB · Views: 43
Solution
to help figure things out,
..i add a bubble to display variables.
..another thing is to simplify formulas. your plot has 5 conditions. put a # in front of a couple code lines and see what happens.
..after staring at many bubbles, it seems that conditions 2,3,5 are almost never true at the same time. this might not mean anything?

def Pattern1 =
IsDown[1] and
IsDown[0] and
(close[1] < close[0]);
# and
#(open[1] >= open[0]) and
#(low[0] == Lowest(low[0], 2));



a couple of things,
..i think the plot formula is working, it just isn't true very often.
..a boolean green point is on the candle, and may be covered up. so you will probably not see most of the plots.

i added a bubble to display all plot variables, 1 or 0. if they are all true, then plot a yellow bubble.
the bubble is almost never yellow.

i added a cyan triangle , to replace the green point. it is much more noticable.


test with MO on a day chart. shows 3 yellow bubbles on the chart.


Code:
#pattern_help2

#https://usethinkscript.com/threads/candle-pattern-help.19000/
#candle pattern help

def na = double.nan;
def bn = barnumber();

#def IsUp = close > open;
def IsDown = close < open;
#def IsDoji = IsDoji();
#def avgRange = 0.05 * Average(high - low, 20);
def Pattern1 =
IsDown[1] and
IsDown[0] and
(close[1] < close[0]) and
(open[1] >= open[0]) and
(low[0] == Lowest(low[0], 2));

plot PatternPlot = if pattern1 then high*1.01 else na;
patternplot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
#PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
#PatternPlot.SetDefaultColor(GetColor(6));
PatternPlot.SetDefaultColor(Color.cyan);
patternplot.setlineweight(5);
patternplot.hidebubble();


input test1 = yes;
AddChartBubble(test1, low,
(IsDown[1] + "\n" +
 IsDown[0] + "\n" +
 (close[1] < close[0]) + "\n" +
 (open[1] >= open[0]) + "\n" +
 (low[0] == Lowest(low[0], 2)) + "\n" +
 Pattern1)
, ( if pattern1 then color.yellow else color.gray), no);
#
Thank you so much. You are right. my conditions were wrong earlier.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
469 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top