- Platform
-
- Thinkorswim
Trend indicator based off Ema of Ema code I posted earlier, you can adjust the aggreation to view trend of larger timeframes on the same chart.
3-Day Trend on 3-Day Chart
1-Month Trend on 3-Day Chart
3-Day Trend on 3-Day Chart
1-Month Trend on 3-Day Chart
Code:
#Ema Trend
#Ghost
input length = 3;
input agg = aggregationPeriod.MONTH;
def price = close(period = agg);
def emaf = ExpAverage(price, length);
def ema144 = expaverage(emaf, 138);
def fibavg = ema144 ;
def ema145 = expaverage(emaf, 155);
def fibavg1 = ema145 ;
def ema146 = ExpAverage(emaf, 38);
def fibavg2 = ema146 ;
def ema147 = ExpAverage(emaf, 55);
def fibavg12 = ema147 ;
AssignPriceColor(if emaf >= fibavg2 then color.green else if emaf < fibavg12 then color.red else Color.CURRENT);