Ema crossing candles

Happymono

New member
Tried to edit a script i found posted here to show different colors depending on the location of price around the ema's the script edited below is getting there but i can't figure out the transition colors correctly or when its between ema's

vmGJSPC.png


Ey6W5L2k


Code:
input evg1 = 50;
input evg2 = 200;
def EMA1 = ExpAverage(close[-0], evg1);
def EMA2 = ExpAverage(close[-0], evg2);

AssignPriceColor (if close > EMA2
then if open > close
then Color.cyan
else Color.cyan
else if close > EMA1
then if open > close
then Color.green
else Color.green
else if close < EMA2
then if open < close
then Color.red
else Color.red
else if close < EMA1
then if open < close
then Color.dark_ORANGE
else Color.dark_ORANGE
else color.yellow );
 
Last edited by a moderator:

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
Is this based on another indicator from TradingView? If so, post that code as well so we can convert it for you.
 

Happymono

New member
Code:

Code:
//@version=3
//DEPTHHOUSE EMA CANDLESTICKS by oh92
//if you edit please drop a line :)
//
study(title="EMA Candles", shorttitle="DepthHouse EMA Candles", overlay=true)

////INPUTS////
src = input(title="Source", type=source, defval=close)
fast=input(50) //Fast EMA Band
slow=input(200) //Slow EMA Band

////EMA FORMULAS////
fe=ema(src,fast)
se=ema(src,slow)

////OH92's FAVORITE COLORS////
g = #8cffe5
r = #ff848a
gg = #adff75
rr = #ff80be
w = #ffffff

////BAR COLOR FORMULA////
bc=fe>se?crossunder(src,se)?w:src>fe?g:src>se?gg:w:crossover(src,se)?w:src<fe?r:src<se?rr:src>fe?src>se?gg:na:na

///OUTPUT///
barcolor(bc)
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
@Happymono Here you go. Credit to @diazlaz

Code:
# DEPTHHOUSE EMA CANDLESTICKS by oh92
# Converted from https://www.tradingview.com/script/qcCrtv61-DepthHouse-Exponential-Candles/

input src = close;
input fast = 50;
input slow = 200;

def fe = ExpAverage(src, fast);
def se = ExpAverage(src, slow);

plot pFast = fe;
plot pSlow = se;

AssignPriceColor(
if fe > se then
if src crosses below se then color.white else
if src > fe then color.green else
if src > se then color.dark_green else
color.white else
if src crosses above se then color.white else
if src < fe then color.red else if src < se then color.dark_red else
if src > fe then if src > se then color.dark_green else color.dark_gray
else color.dark_gray
);
 

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.
Top