Zlema Cross not plotting

TraderJane

New member
I am creating a Zero lag 3 EMA strategy. I have ZLEMA as fast, ZLEMAa as medium, and ZLEMAb as slow.
I am trying to get buy signal when ZLEMA crosses above ZLEMAa and ZLEMAb. (Preferably would like to have ZLEMAb below ZLEMAa as an optional condition) and a Sell Signal when ZLEMAb Crosses above ZLEMA and ZLEMAa (Preferably would like to have ZLEMA below ZLEMAa as an optional condition.

I am trying to get an exit signal when the ZLEMAa crosses ZLEMAb.

Code:
# ZLEMA Strategy

input Period = 20;
input src = close;
input Period2 = 40;
input src2 = close;
input Period3 = 60;
input src3 = close;

def EMA341 = ExpAverage(src, Period);
def EMA342 = ExpAverage(EMA341, Period);
def Difference34 = EMA341 - EMA342;
def ZeroLagEMA34 = EMA341 + Difference34;
plot ZLEMA = ZeroLagEMA34;
ZLEMA.SetDefaultColor(Color.green);

def EMA341a = ExpAverage(src2, Period2);
def EMA342a = ExpAverage(EMA341, Period2);
def Difference34a = EMA341a - EMA342a;
def ZeroLagEMA34a = EMA341a + Difference34a;
plot ZLEMAa = ZeroLagEMA34a;
ZLEMAa.SetDefaultColor(Color.red);

def EMA341b = ExpAverage(src3, Period3);
def EMA342b = ExpAverage(EMA341b, Period3);
def Difference34b = EMA341b - EMA342b;
def ZeroLagEMA34b = EMA341b + Difference34b;
plot ZLEMAb = ZeroLagEMA34b;
ZLEMAb.SetDefaultColor(Color.blue);

# Buy signal
def buySignal = ZLEMA crosses above ZLEMAa and ZLEMAb is less than or equal to ZLEMAa;
plot buySignalPlot = buySignal;
buySignalPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
buySignalPlot.SetDefaultColor(Color.green);

# Sell signal
def sellSignal = ZLEMAb crosses above ZLEMA and ZLEMA is less than or equal to ZLEMAa;
plot sellSignalPlot = sellSignal;
sellSignalPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
sellSignalPlot.SetDefaultColor(Color.red);

# Buy exit signal
def buyExitSignal = ZLEMAb crosses above ZLEMAa;
plot buyExitSignalPlot = buyExitSignal;
buyExitSignalPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
buyExitSignalPlot.SetDefaultColor(Color.yellow);

# Sell exit signal
def sellExitSignal = ZLEMAb crosses above ZLEMA or ZLEMA crosses Above ZLEMAb;
plot sellExitSignalPlot = sellExitSignal;
sellExitSignalPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
sellExitSignalPlot.SetDefaultColor(Color.yellow);

# Alerts
alert(buySignal, "Buy signal", Alert.BAR, Sound.Bell);
alert(sellSignal, "Sell signal", Alert.BAR, Sound.Chimes);
#alert(buyExitSignal, "Buy exit signal", Alert.BAR, Sound.Bell);
alert(sellExitSignal, "Sell exit signal", Alert.BAR, Sound.Chimes);

def ExitSignal = ZLEMAb crosses Above ZLEMA;
plot ExitSignalplot = ExitSignal;
ExitSignalplot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
sellExitSignalPlot.SetDefaultColor(Color.yellow);
 
I am trying to get buy signal when ZLEMA crosses above ZLEMAa and ZLEMAb

6CUNa9w.png


The signals seem to be plotting.

What exactly is the error?
 

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