need a study that does the following
# the following conditions should be true for both the time periods
if aggregation period is 1 min and 5 min
then check for
if (EMA 12 cross down 20 ) and (MACD crossover down 0 line)
alert with sell label
if (EMA 12 cross above 20 ) and (MACD crossover above buy line)
alert with buy label
Ema 12 and Ema 20 crossovers
Macd zero line not buy line
def UpSignal = if value crosses above avg
# or Diff > ZeroLine
then 1 else 0;
def DownSignal = if value crosses below avg
#or Diff < ZeroLine
then 1 else 0;
AssignPriceColor(if
close crosses below ExpAverage(close, 50 ) and DownSignal==1 and avgExp1 < avgExp2
then Color.WHITE else Color.CURRENT);
AssignPriceColor(if
close crosses above ExpAverage(close, 50 ) and UpSignal==1 and avgExp1 > avgExp2
then Color.YELLOW else Color.CURRENT);
Caveat: I did not check for errors throughout your whole script.
But this error jumped out:
You can only have ONE AssignPriceColor statement per script
Change this:
AssignPriceColor(if
close crosses below ExpAverage(close, 50 ) and DownSignal==1 and avgExp1 < avgExp2
then Color.WHITE else Color.CURRENT);
AssignPriceColor(if
close crosses above ExpAverage(close, 50 ) and UpSignal==1 and avgExp1 > avgExp2
then Color.YELLOW else Color.CURRENT);
AssignPriceColor(
if close crosses below ExpAverage(close, 50 ) and DownSignal==1 and avgExp1 < avgExp2
then Color.WHITE else
if close crosses above ExpAverage(close, 50 ) and UpSignal==1 and avgExp1 > avgExp2
then Color.YELLOW else Color.CURRENT);
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.
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.