# ema10_50_cloud
#https://usethinkscript.com/threads/10ema-cross-50-ema-cloud.20123/
# Questions UnAnswered Graveyard
# 10ema cross 50 ema & cloud
# Dec 21, 2024
#I need help to create 10/50 ema cloud, when the 10ema cross the 50 ema on the 30min tf, gives a buy signal , as well to the downside.
def na = double.nan;
def bn = barnumber();
def data = close;
input avg1_type = AverageType.exponential;
input avg1_length = 10;
def avg1 = MovingAverage(avg1_type, data, avg1_length );
input avg2_type = AverageType.exponential;
input avg2_length = 50;
def avg2 = MovingAverage(avg2_type, data, avg2_length );
plot zavg1 = avg1;
plot zavg2 = avg2;
zavg1.SetDefaultColor(Color.cyan);
zavg1.setlineweight(1);
zavg1.hidebubble();
zavg2.SetDefaultColor(Color.yellow);
zavg2.setlineweight(1);
zavg2.hidebubble();
def xup = avg1 crosses above avg2;
def xdwn = avg1 crosses below avg2;
plot zup = if xup then low*0.994 else na;
zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zup.SetDefaultColor(Color.cyan);
zup.setlineweight(3);
zup.hidebubble();
plot zdwn = if xdwn then high*1.006 else na;
zdwn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
zdwn.SetDefaultColor(Color.yellow);
zdwn.setlineweight(3);
zdwn.hidebubble();
addcloud(avg1,avg2,color.green, color.red);
#---------------------------------------
#https://toslc.thinkorswim.com/center/reference/thinkScript/Constants/AverageType
#input avg1_type = AverageType.Simple;
#input avg1_type = AverageType.exponential;
#input avg1_type = AverageType.hull;
#input avg1_type = AverageType.weighted;
#input avg1_type = AverageType.wilders;
#