Marubozu Candlesticks For ThinkOrSwim

djgLXXII

New member
I imagine this is very simple. What I want to do is take the existing Marubozu candlestick script and have it ONLY apply to today's price. I do not care about the past. Ultimately, I want to use this in a scan filter.

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2011-2021
#
#wizard plots
#wizard text: Inputs: length:
#wizard input: length

input length = 20;

def ErrMargin = 0.05 * Average(BodyHeight(), length);

plot Bearish = IsLongBlack(length) and
    high - open <= ErrMargin and
    close - low <= ErrMargin;

plot Bullish = IsLongWhite(length) and
    open - low <= ErrMargin and
    high - close <= ErrMargin;

Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(GetColor(7));
Bearish.SetLineWeight(2);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(GetColor(8));
Bullish.SetLineWeight(2);
 
I imagine this is very simple. What I want to do is take the existing Marubozu candlestick script and have it ONLY apply to today's price. I do not care about the past. Ultimately, I want to use this in a scan filter.

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2011-2021
#
#wizard plots
#wizard text: Inputs: length:
#wizard input: length

input length = 20;

def ErrMargin = 0.05 * Average(BodyHeight(), length);

plot Bearish = IsLongBlack(length) and
    high - open <= ErrMargin and
    close - low <= ErrMargin;

plot Bullish = IsLongWhite(length) and
    open - low <= ErrMargin and
    high - close <= ErrMargin;

Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(GetColor(7));
Bearish.SetLineWeight(2);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(GetColor(8));
Bullish.SetLineWeight(2);

Use this scan tutorial: https://usethinkscript.com/threads/how-to-use-thinkorswim-stock-hacker-scans.284/
Scan for:
Bullish is true
 
Last edited:
https%3A//i.imgur.com/BuHxST8.jpg[/img]']
BuHxST8.jpg


Hi, attempted to write the bearish kicker Candlestick pattern and also to find this kind of setup after the stock has few days of price accelerating. The current script manages to find the desired candlestick but I would like to make the following adjustments.

As I found it difficult to get bearish Marubozu candlestick, may i know how can i write the condition for the bearish candle to close lower at least 75% of the candle body and the stock has moved up last 3 days

declare upper;

def condition1 = close[1] > open[1];#bullish Bar
def condition2 = open<low[1];
def condition3 = close<open;
plot signal = condition1 and condition2 and condition3;
AddChartBubble(signal, high, "k", Color.white,yes);
 
Hi,

I need help to setup a column that will show me:

if it's marubozu candle,

there's already a code in thinkorswim to find this kind of candle,

I just need it to return is yes or no.

for example - this is the code from thinkorswim:

input length = 20;

def ErrMargin = 0.05 * Average(BodyHeight(), length);

plot Bearish = IsLongBlack(length) and
high - open <= ErrMargin and
close - low <= ErrMargin;

plot Bullish = IsLongWhite(length) and
open - low <= ErrMargin and
high - close <= ErrMargin;

____________________________________________________________________________________

I want to check if it is bearish candle - then return "TRUE", with red background.
else
if it bullish candle = then return "True", with green background.

if it not the one of those options then return - "FALSE".

thanks.
 
Hi,

I need help to setup a column that will show me:

if it's marubozu candle,

there's already a code in thinkorswim to find this kind of candle,

I just need it to return is yes or no.

for example - this is the code from thinkorswim:

input length = 20;

def ErrMargin = 0.05 * Average(BodyHeight(), length);

plot Bearish = IsLongBlack(length) and
high - open <= ErrMargin and
close - low <= ErrMargin;

plot Bullish = IsLongWhite(length) and
open - low <= ErrMargin and
high - close <= ErrMargin;

____________________________________________________________________________________

I want to check if it is bearish candle - then return "TRUE", with red background.
else
if it bullish candle = then return "True", with green background.

if it not the one of those options then return - "FALSE".

thanks.

This will reture a red/green TRUE in a column, otherwise a black blank.

Ruby:
input length = 20;

def ErrMargin = 0.05 * Average(BodyHeight(), length);

plot Bearish = IsLongBlack(length) and
high - open <= ErrMargin and
close - low <= ErrMargin;

plot Bullish = IsLongWhite(length) and
open - low <= ErrMargin and
high - close <= ErrMargin;

addlabel(1, if bearish or bullish then "TRUE" else "", if bearish then color.red else if bullish then color.green else color.black);
 
This will reture a red/green TRUE in a column, otherwise a black blank.


Ruby:
input length = 20;

def ErrMargin = 0.05 * Average(BodyHeight(), length);

plot Bearish = IsLongBlack(length) and
high - open <= ErrMargin and
close - low <= ErrMargin;

plot Bullish = IsLongWhite(length) and
open - low <= ErrMargin and
high - close <= ErrMargin;

addlabel(1, if bearish or bullish then "TRUE" else "", if bearish then color.red else if bullish then color.green else color.black);
Thanks,

I've checked the code, and it works only when i find bullish, when i search for bearish, it show black.
why is that ?
 

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
334 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