8ema candlestick pattern

TDTOS

Member
There is a strategy that seems to produce good results and seeing if it can be made here. Attached is an infographic explaining the rules but here is a summary.


Plot the 8EMA

For long:
1. Red candle and then a green candle that has a Lower low and a lower high but closes within the body of the red candle. Green candle must close above 8 EMA. A repainting arrow would be excellent during the formation of the candle which would stay permanent when the candle closes with conditions met.

For short:
1. Green candle and then a red candle that has a higher high and a higher low but closes within the body of the green candle. Red candle must close below 8EMA. A repainting arrow would be excellent during the formation of the candle which would stay permanent when the candle closes with conditions met.

Thank you!
 

Attachments

  • 15_Minute_NQ_Scalp_Trader_Rob.png
    15_Minute_NQ_Scalp_Trader_Rob.png
    121.5 KB · Views: 86
Solution
There is a strategy that seems to produce good results and seeing if it can be made here. Attached is an infographic explaining the rules but here is a summary.


Plot the 8EMA

For long:
1. Red candle and then a green candle that has a Lower low and a lower high but closes within the body of the red candle. Green candle must close above 8 EMA. A repainting arrow would be excellent during the formation of the candle which would stay permanent when the candle closes with conditions met.

For short:
1. Green candle and then a red candle that has a higher high and a higher low but closes within the body of the green candle. Red candle must close below 8EMA. A repainting arrow would be excellent during the formation of the...
There is a strategy that seems to produce good results and seeing if it can be made here. Attached is an infographic explaining the rules but here is a summary.


Plot the 8EMA

For long:
1. Red candle and then a green candle that has a Lower low and a lower high but closes within the body of the red candle. Green candle must close above 8 EMA. A repainting arrow would be excellent during the formation of the candle which would stay permanent when the candle closes with conditions met.

For short:
1. Green candle and then a red candle that has a higher high and a higher low but closes within the body of the green candle. Red candle must close below 8EMA. A repainting arrow would be excellent during the formation of the candle which would stay permanent when the candle closes with conditions met.

Thank you!

your rules don't match,

your post mentions 2 price parameters, ( low and high)
green candle that has a Lower low and a lower high

and the image mentions only one, (low)
green candle that has a Lower low
 

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

There is a strategy that seems to produce good results and seeing if it can be made here. Attached is an infographic explaining the rules but here is a summary.


Plot the 8EMA

For long:
1. Red candle and then a green candle that has a Lower low and a lower high but closes within the body of the red candle. Green candle must close above 8 EMA. A repainting arrow would be excellent during the formation of the candle which would stay permanent when the candle closes with conditions met.

For short:
1. Green candle and then a red candle that has a higher high and a higher low but closes within the body of the green candle. Red candle must close below 8EMA. A repainting arrow would be excellent during the formation of the candle which would stay permanent when the candle closes with conditions met.

Thank you!

here is something to experiment with,
i wasn't seeing many triggers with all 6 rules, so i had it draw dots if more than 4 rules happened
draws the rule count if 4 or more,
colored dots , if 4,5,6 rules
draws a horizontal line for a buy level if 4+ rules happen
draw arrow when all 6 rules happen
draws things for long and short trades

doesn't include stop or target


Code:
#ema_2bar_pattern

#https://usethinkscript.com/threads/8ema-candlestick-pattern.17736/
#8ema candlestick pattern


# Plot the EMA8

#===========================
#LONG trade:
#===========================

#EMA8 is rising
#Red candle
#then a green candle that,
#..has a Lower low and a lower high,
#..closes within the body of the red candle.
#..green candle must close above 8 EMA.
#..a yellow warn up arrow under green candle

#entry:
#1 tick above green bar
#(or as long as EMA is rising)

#stop:
#20 to 35 points (based on bar before entry)

#target:
#35 points or 1:1 , whichever is less


#===========================
#SHORT:
#===========================

#EMA8 is falling
#Green candle
#then a red candle that,
#..has a higher high and a higher low,
#..closes within the body of the green candle.
#..red candle must close below 8EMA.
#..a yellow warn down arrow above red candle

#entry:
#1 tick below red bar
#(or as long as EMA is falling)

#stop:
#20 to 35 points (based on bar before entry)

#target:
#35 points or 1:1 , whichever is less

#===========================


def na = double.nan;
def bn = barnumber();
def data = close;
def t = tickvalue();
def y = 0.002;

input minqty = 4;
#input minqty = 5;
input show_warn_dots = yes;

input warn_dots_to_show = { default "4" , "5" , "6" };

input avg1_type = AverageType.exponential;
#input avg1_type = AverageType.Simple;
input avg1_length = 8;
def avg1 = MovingAverage(avg1_type, data, avg1_length );

input show_average_lines = yes;
plot zavg1 = if show_average_lines then avg1 else na;
zavg1.SetDefaultColor(Color.cyan);
zavg1.setlineweight(1);
zavg1.hidebubble();


def grn = close > open;
def red = close < open;
def redgrn = red[1] and grn;
def grnred = grn[1] and red;

def bodytop = max(open, close);
def bodybot = min(open, close);


# buy---------------  red-green
def b1 = avg1 > avg1[1];
def b2 = red[1];
def b3 = grn;
#def b4 = low < low[1] and high < high[1];
def b4 = low < low[1];
def b5 = close > bodybot[1] and close < bodytop[1];
def b6 = close > avg1;

def warnb = b1 and b2 and b3 and b4 and b5 and b6;
def b_cnt = b1 + b2 + b3 + b4 + b5 + b6;
# optional   b5

def wb = (redgrn and b_cnt >= minqty);

def long_open_level = if wb then (high + t)
else if wb[1] then (high[1] + t)
else if wb[2] then (high[2] + t)
else na;

plot zlonglvl = long_open_level;
zlonglvl.SetDefaultColor(Color.cyan);
zlonglvl.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);


#plot zupwarn = if warn then low*(1-y) else na;
plot zupwarn = if (show_warn_dots and redgrn and b_cnt >= minqty) then low*(1-y) else na;
zupwarn.SetPaintingStrategy(PaintingStrategy.points);
#zupwarn.SetDefaultColor(Color.yellow);
zupwarn.AssignValueColor(if b_cnt == 6 then color.green else if (redgrn and b_cnt == 5) then color.cyan else if (redgrn and b_cnt == 4) then color.yellow else color.gray);
zupwarn.setlineweight(4);
zupwarn.hidebubble();


plot zup = if (b_cnt == 6) then low*(1-(2*y)) else na;
zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zup.SetDefaultColor(Color.white);
zup.setlineweight(4);
zup.hidebubble();


plot zv1 = if (redgrn and b_cnt >= minqty) then b_cnt else na;
zv1.SetPaintingStrategy(PaintingStrategy.VALUES_below); 
zv1.SetDefaultColor(Color.white);

input test1 = no;
addchartbubble(test1, low,
b1 + "\n" +
b2 + "\n" +
b3 + "\n" +
b4 + "\n" +
b5 + "\n" +
b6 + "\n" 
, (if b_cnt == 6 then color.green else if (redgrn and b_cnt >= minqty) then color.yellow else color.gray), no);


# sell ---------------  green-red
def s1 = avg1 < avg1[1];
def s2 = grn[1];
def s3 = red;
def s4 = low > low[1] and high > high[1];
def s5 = close > bodybot[1] and close < bodytop[1];
def s6 = close < avg1;

def warns = s1 and s2 and s3 and s4 and s5 and s6;
def s_cnt = s1 + s2 + s3 + s4 + s5 + s6;
# optional   s5

def ws = (grnred and s_cnt >= minqty);

def short_open_level = if ws then (low - t)
else if ws[1] then (low[1] - t)
else if ws[2] then (low[2] - t)
else na;

plot zshortlvl = short_open_level;
zshortlvl.SetDefaultColor(Color.magenta);
zshortlvl.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);


plot zdwnwarn = if (show_warn_dots and grnred and s_cnt >= minqty) then high*(1+y) else na;
zdwnwarn.SetPaintingStrategy(PaintingStrategy.points);
#zdwnwarn.SetDefaultColor(Color.yellow);
zdwnwarn.AssignValueColor(if s_cnt == 6 then color.red else if (grnred and s_cnt == 5) then color.magenta else if (grnred and s_cnt == 4) then color.yellow else color.gray);
zdwnwarn.setlineweight(4);
zdwnwarn.hidebubble();


plot zdwn = if (s_cnt == 6) then high*(1+(2*y)) else na;
zdwn.SetPaintingStrategy(PaintingStrategy.ARROW_down);
zdwn.SetDefaultColor(Color.white);
zdwn.setlineweight(4);
zdwn.hidebubble();


plot zv2 = if (grnred and s_cnt >= minqty) then s_cnt else na;
zv2.SetPaintingStrategy(PaintingStrategy.VALUES_above); 
zv2.SetDefaultColor(Color.white);

input test2 = no;
addchartbubble(test2, low,
s1 + "\n" +
s2 + "\n" +
s3 + "\n" +
s4 + "\n" +
s5 + "\n" +
s6 + "\n" 
, (if s_cnt == 6 then color.green else if (grnred and s_cnt >= minqty) then color.yellow else color.gray), no);

#

20j31KO.jpeg
 
Solution
here is something to experiment with,
i wasn't seeing many triggers with all 6 rules, so i had it draw dots if more than 4 rules happened
draws the rule count if 4 or more,
colored dots , if 4,5,6 rules
draws a horizontal line for a buy level if 4+ rules happen
draw arrow when all 6 rules happen
draws things for long and short trades

doesn't include stop or target


Code:
#ema_2bar_pattern

#https://usethinkscript.com/threads/8ema-candlestick-pattern.17736/
#8ema candlestick pattern


# Plot the EMA8

#===========================
#LONG trade:
#===========================

#EMA8 is rising
#Red candle
#then a green candle that,
#..has a Lower low and a lower high,
#..closes within the body of the red candle.
#..green candle must close above 8 EMA.
#..a yellow warn up arrow under green candle

#entry:
#1 tick above green bar
#(or as long as EMA is rising)

#stop:
#20 to 35 points (based on bar before entry)

#target:
#35 points or 1:1 , whichever is less


#===========================
#SHORT:
#===========================

#EMA8 is falling
#Green candle
#then a red candle that,
#..has a higher high and a higher low,
#..closes within the body of the green candle.
#..red candle must close below 8EMA.
#..a yellow warn down arrow above red candle

#entry:
#1 tick below red bar
#(or as long as EMA is falling)

#stop:
#20 to 35 points (based on bar before entry)

#target:
#35 points or 1:1 , whichever is less

#===========================


def na = double.nan;
def bn = barnumber();
def data = close;
def t = tickvalue();
def y = 0.002;

input minqty = 4;
#input minqty = 5;
input show_warn_dots = yes;

input warn_dots_to_show = { default "4" , "5" , "6" };

input avg1_type = AverageType.exponential;
#input avg1_type = AverageType.Simple;
input avg1_length = 8;
def avg1 = MovingAverage(avg1_type, data, avg1_length );

input show_average_lines = yes;
plot zavg1 = if show_average_lines then avg1 else na;
zavg1.SetDefaultColor(Color.cyan);
zavg1.setlineweight(1);
zavg1.hidebubble();


def grn = close > open;
def red = close < open;
def redgrn = red[1] and grn;
def grnred = grn[1] and red;

def bodytop = max(open, close);
def bodybot = min(open, close);


# buy---------------  red-green
def b1 = avg1 > avg1[1];
def b2 = red[1];
def b3 = grn;
#def b4 = low < low[1] and high < high[1];
def b4 = low < low[1];
def b5 = close > bodybot[1] and close < bodytop[1];
def b6 = close > avg1;

def warnb = b1 and b2 and b3 and b4 and b5 and b6;
def b_cnt = b1 + b2 + b3 + b4 + b5 + b6;
# optional   b5

def wb = (redgrn and b_cnt >= minqty);

def long_open_level = if wb then (high + t)
else if wb[1] then (high[1] + t)
else if wb[2] then (high[2] + t)
else na;

plot zlonglvl = long_open_level;
zlonglvl.SetDefaultColor(Color.cyan);
zlonglvl.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);


#plot zupwarn = if warn then low*(1-y) else na;
plot zupwarn = if (show_warn_dots and redgrn and b_cnt >= minqty) then low*(1-y) else na;
zupwarn.SetPaintingStrategy(PaintingStrategy.points);
#zupwarn.SetDefaultColor(Color.yellow);
zupwarn.AssignValueColor(if b_cnt == 6 then color.green else if (redgrn and b_cnt == 5) then color.cyan else if (redgrn and b_cnt == 4) then color.yellow else color.gray);
zupwarn.setlineweight(4);
zupwarn.hidebubble();


plot zup = if (b_cnt == 6) then low*(1-(2*y)) else na;
zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zup.SetDefaultColor(Color.white);
zup.setlineweight(4);
zup.hidebubble();


plot zv1 = if (redgrn and b_cnt >= minqty) then b_cnt else na;
zv1.SetPaintingStrategy(PaintingStrategy.VALUES_below);
zv1.SetDefaultColor(Color.white);

input test1 = no;
addchartbubble(test1, low,
b1 + "\n" +
b2 + "\n" +
b3 + "\n" +
b4 + "\n" +
b5 + "\n" +
b6 + "\n"
, (if b_cnt == 6 then color.green else if (redgrn and b_cnt >= minqty) then color.yellow else color.gray), no);


# sell ---------------  green-red
def s1 = avg1 < avg1[1];
def s2 = grn[1];
def s3 = red;
def s4 = low > low[1] and high > high[1];
def s5 = close > bodybot[1] and close < bodytop[1];
def s6 = close < avg1;

def warns = s1 and s2 and s3 and s4 and s5 and s6;
def s_cnt = s1 + s2 + s3 + s4 + s5 + s6;
# optional   s5

def ws = (grnred and s_cnt >= minqty);

def short_open_level = if ws then (low - t)
else if ws[1] then (low[1] - t)
else if ws[2] then (low[2] - t)
else na;

plot zshortlvl = short_open_level;
zshortlvl.SetDefaultColor(Color.magenta);
zshortlvl.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);


plot zdwnwarn = if (show_warn_dots and grnred and s_cnt >= minqty) then high*(1+y) else na;
zdwnwarn.SetPaintingStrategy(PaintingStrategy.points);
#zdwnwarn.SetDefaultColor(Color.yellow);
zdwnwarn.AssignValueColor(if s_cnt == 6 then color.red else if (grnred and s_cnt == 5) then color.magenta else if (grnred and s_cnt == 4) then color.yellow else color.gray);
zdwnwarn.setlineweight(4);
zdwnwarn.hidebubble();


plot zdwn = if (s_cnt == 6) then high*(1+(2*y)) else na;
zdwn.SetPaintingStrategy(PaintingStrategy.ARROW_down);
zdwn.SetDefaultColor(Color.white);
zdwn.setlineweight(4);
zdwn.hidebubble();


plot zv2 = if (grnred and s_cnt >= minqty) then s_cnt else na;
zv2.SetPaintingStrategy(PaintingStrategy.VALUES_above);
zv2.SetDefaultColor(Color.white);

input test2 = no;
addchartbubble(test2, low,
s1 + "\n" +
s2 + "\n" +
s3 + "\n" +
s4 + "\n" +
s5 + "\n" +
s6 + "\n"
, (if s_cnt == 6 then color.green else if (grnred and s_cnt >= minqty) then color.yellow else color.gray), no);

#

20j31KO.jpeg
Thank you very much! I appreciate it!
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
382 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