20 EMA Labels/Alerts

RichTrades

New member
Platform
  1. Thinkorswim
Hey Barb, would it be possible to create a study that plots labels/alerts when price either closes or is above/below 20ema on different time frames? I often like taking shorts when price is below 20ema on 15m frame for example and this would help with not switching between timeframes intraday. @barbaros
 
Last edited:

RichTrades

New member
Hey Barb, would it be possible to create a study that plots labels/alerts when price either closes or is above/below 20ema on different time frames? I often like taking shorts when price is below 20ema on 15m frame for example and this would help with not switching between timeframes intraday. @barbaros


input agg = aggregationperiod.day;

def ema1 = expaverage(close(period = agg), 8);
def ema2 = expaverage(close(period = agg), 20);

AddLabel(1, if ema1 > ema2 then " 8ema is ABOVE 20ema " else if ema1 == ema2 then " 8ema is equal to 20ema " else " 8ema is BELOW 20ema", if ema1 > ema2 then color.green else if ema1 == ema2 then color.white else color.red);


I have created the labels for 8ema/20ema crosses with ability to change aggregations based on which timeframe... Just need to add alerts for these crosses and I would be happy. :)
 

barbaros

Administrator
Staff member
input agg = aggregationperiod.day;

def ema1 = expaverage(close(period = agg), 8);
def ema2 = expaverage(close(period = agg), 20);

AddLabel(1, if ema1 > ema2 then " 8ema is ABOVE 20ema " else if ema1 == ema2 then " 8ema is equal to 20ema " else " 8ema is BELOW 20ema", if ema1 > ema2 then color.green else if ema1 == ema2 then color.white else color.red);


I have created the labels for 8ema/20ema crosses with ability to change aggregations based on which timeframe... Just need to add alerts for these crosses and I would be happy. :)
Excellent.
 
Top