Sneaky_Swings
Member
This indicator was designed to show how price is reacting in relation to the 5 Fibonacci ma lengths 8, 21, 34, 55, 89. Additionally, I have added in price in relation to VWAP as the top line of the code. I have found that moving averages act as moving supports/resistance for price. If these averages can "stack" for longs (all green/yellow) or for shorts (orange/red) price is much more likely to follow the trend because the moving averages push it in the desired direction. The Filthy Trends indicator allows you to see what moving averages are doing while also reducing screen clutter.
The indicator is laid out as follows:
Link to indicator: http://tos.mx/cIx0HHy
The indicator is laid out as follows:
- Top Line= Price relation to VWAP
- Following Lines = Price relation to ema lengths starting with 8 and descending in order
- Green= Price > MA and MA > then the next MA length for example green on the second line = 8 > 21 and Close > 8
- Yellow = Price > MA and MA < the next MA length
- Orange = Price < MA and MA > the next MA length
- Red = Price < MA and MA < the next MA length
Code:
#Designed to find trends so you trade with them rather than against them
#Green means full bull trend, Red means full bear trend, Orange indicates that Price is starting to fall out of the trend to the downside, Yellow indicates price is falling out of trend to the upside
#Created by SneaySwings 1/28/2021
declare lower;
input price = close;
input displace = 0;
input length1 = 8;
input length2 = 21;
input length3 = 34;
input length4 = 55;
input length5 = 89;
def ema1 = ExpAverage(price[-displace], length1);
def ema2 = ExpAverage(price[-displace], length2);
def ema3 = ExpAverage(price[-displace], length3);
def ema4 = ExpAverage(price[-displace], length4);
def ema5 = ExpAverage(price[-displace], length5);
plot ema8 = 2;
ema8.setpaintingStrategy(paintingstrategy.LINE_VS_POINTS);
ema8.setLineWeight(3);
ema8.assignValueColor(if close > ema1 and ema1 > ema2 then color.green else if close < ema1 and ema1 < ema2 then color.red else if close > ema1 and ema1 < ema2 then color.yellow else color.dark_orange);
plot ema21 = 1;
ema21.setpaintingStrategy(paintingstrategy.LINE_VS_POINTS);
ema21.setLineWeight(3);
ema21.assignValueColor(if close > ema2 and ema2 > ema3 then color.green else if close < ema2 and ema2 < ema3 then color.red else if close > ema2 and ema2 < ema3 then color.yellow else color.dark_orange);
plot ema34 = 0;
ema34.setpaintingStrategy(paintingstrategy.LINE_VS_POINTS);
ema34.setLineWeight(3);
ema34.assignValueColor(if close > ema3 and ema3 > ema4 then color.green else if close < ema3 and ema3 < ema4 then color.red else if close > ema3 and ema3 < ema4 then color.yellow else color.dark_orange);
plot ema55 = -1;
ema55.setpaintingStrategy(paintingstrategy.LINE_VS_POINTS);
ema55.setLineWeight(3);
ema55.assignValueColor(if close > ema4 and ema4 > ema5 then color.green else if close < ema4 and ema4 < ema5 then color.red else if close > ema4 and ema4 < ema5 then color.yellow else color.dark_orange);
plot ema89 = -2;
def ma = movavgExponential(price, 144);
ema89.setpaintingStrategy(paintingstrategy.LINE_VS_POINTS);
ema89.setLineWeight(3);
ema89.assignValueColor(if close > ema5 and ema5 > ma then color.green else if close < ema5 and ema5 < ma then color.red else if close > ema5 and ema5 < ma then color.yellow else color.dark_orange);
#Vwap for the ****ing Boys
input timeFrame = {default DAY, WEEK, MONTH};
def cap = getAggregationPeriod();
def errorInAggregation =
timeFrame == timeFrame.DAY and cap >= AggregationPeriod.WEEK or
timeFrame == timeFrame.WEEK and cap >= AggregationPeriod.MONTH;
assert(!errorInAggregation, "timeFrame should be not less than current chart aggregation period");
def yyyyMmDd = getYyyyMmDd();
def periodIndx;
switch (timeFrame) {
case DAY:
periodIndx = yyyyMmDd;
case WEEK:
periodIndx = Floor((daysFromDate(first(yyyyMmDd)) + getDayOfWeek(first(yyyyMmDd))) / 7);
case MONTH:
periodIndx = roundDown(yyyyMmDd / 100, 0);
}
def isPeriodRolled = compoundValue(1, periodIndx != periodIndx[1], yes);
def volumeSum;
def volumeVwapSum;
def volumeVwap2Sum;
if (isPeriodRolled) {
volumeSum = volume;
volumeVwapSum = volume * vwap;
volumeVwap2Sum = volume * Sqr(vwap);
} else {
volumeSum = compoundValue(1, volumeSum[1] + volume, volume);
volumeVwapSum = compoundValue(1, volumeVwapSum[1] + volume * vwap, volume * vwap);
volumeVwap2Sum = compoundValue(1, volumeVwap2Sum[1] + volume * Sqr(vwap), volume * Sqr(vwap));
}
def pricev = volumeVwapSum / volumeSum;
def deviation = Sqrt(Max(volumeVwap2Sum / volumeSum - Sqr(price), 0));
def VWAP = pricev;
plot vwap_decision = 3;
vwap_decision.setpaintingStrategy(paintingstrategy.LINE_VS_POINTS);
vwap_decision.setLineWeight(3);
vwap_decision.assignValueColor(if close > vwap then color.green else if close < vwap then color.red else if close crosses above vwap then color.lime else if close crosses below vwap then color.pink else color.current);
Link to indicator: http://tos.mx/cIx0HHy