Jesus Bueno
New member
Hi Ben. This indicator is called MACCcrossOver_w_Alerts. Is it possible to turn it into a strategy? How much does the job cost? Thanks for everything. Happy Days. Jesus
Code:
input EMAPeriod = 10;
input SMAPeriod = 20;
input price = close;
def na = double.nan;
plot fastema = ExpAverage(price, EMAPeriod);
plot slowema = Average(price, SMAPeriod);
def crossover = if fastema > slowema AND fastema[1] <= slowema[1] then 1 else 0;
def crossunder = if fastema < slowema AND fastema[1] >= slowema[1] then 1 else 0;
#Plot arrows
Plot up = if crossover then low - tickSize() else na;
Plot down = if crossunder then high + tickSize() else na;
up.SetPaintingStrategy(paintingStrategy.ARROW_UP);
down.SetPaintingStrategy(paintingStrategy.ARROW_DOWN);
#Trigger alerts
alert(crossover[1], "Crossover", Alert.Bar, Sound.Ding);
alert(crossunder[1], "Crossunder", Alert.Bar, Sound.Ding);