A simple indicator that tries to identify the current trend.
- Red = bearish
- Green = bullish
- White = neutral
Code:
# Simple Trend Score
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/ViXoUfeL/
declare lower;
def TrendScore = if(close >= close[11], 1, -1) + if(close >= close[12], 1, -1) + if(close >= close[13], 1, -1) + if(close >= close[14], 1, -1) + if(close >= close[15], 1, -1) + if(close >= close[16], 1, -1) + if(close >= close[17], 1, -1) + if(close >= close[18], 1, -1) + if(close >= close[19], 1, -1) + if(close >= close[20], 1, -1);
def col1= TrendScore>5;
def col2= TrendScore<-5;
plot histogram = TrendScore;
histogram.assignValueColor(if col1 then Color.Green else if Col2 then Color.Red else Color.White);
assignPriceColor(if col1 then Color.Green else if Col2 then Color.Red else Color.White);