Author Message:
If you like Ichimoku cloud and use it in your analysis, or you are new to it and sometimes gets tricky to figure out all the details, this indicator tries to simplify that and visualize the change of trend and momentum relative to the past based on ichimoku.
The RED/GREEN columns are showing momentum strength while the black diamond line suggests the trend change. The conditions are simple enough to check them out on the script.
As you can see highlighted cyan circles on the chart as major important signals on the chart of Bitcoin daily timeframe.
This script tries to be complementary to the ichimoku cloud itself and cannot replace the levels represented by the cloud on chart.
CODE:
CSS:
# https://www.tradingview.com/v/R225y8rU/
#//@NoaTrader
#indicator(title="Ichimoku Cloud Momentum & Trend Indicator «NoaTrader»", shorttitle="Ichi MTI", overlay=false)
# Converted by Sam4Cok@Samer800 - 02/2024
declare lower;
input colorBars = yes;
input UseWeightedValueForConditions = yes; #,"Use weighted value for conditions", group = "Indicator")
input ConversionLineLength = 9; #, minval=1, title="Conversion Line Length", group = "Ichimoku")
input BaseLineLength = 26; #, minval=1, title="Base Line Length", group = "Ichimoku")
input LeadingSpanBLength = 52; #, minval=1, title="Leading Span B Length", group = "Ichimoku")
input LaggingSpan = 26; #, minval=1, title="Lagging Span", group = "Ichimoku")
def na = Double.NaN;
def is_weighted = UseWeightedValueForConditions;
script donchian {
input len = 9;
def hh = Highest(high, len);
def ll = Lowest(low, len);
def donchian = (hh + ll) / 2;
plot out = donchian;
}
def conversionLine = donchian(ConversionLineLength);
def baseLine = donchian(BaseLineLength);
def leadLine1 = (conversionLine + baseLine) / 2;
def leadLine2 = donchian(LeadingSpanBLength);
def lag = LaggingSpan - 1;
def cloud_top = Max(leadLine1[lag], leadLine2[lag]);
def cloud_bot = Min(leadLine1[lag], leadLine2[lag]);
#// momentun over cloud
def is_mom_over_top = close > cloud_top[lag];
def is_mom_under_bot = close < cloud_bot[lag];
#// price over cloud
def is_price_over_top = close > cloud_top;
def is_price_under_bot = close < cloud_bot;
#//Totals
def total1 = if is_mom_over_top then (if is_weighted then 5 else 1) else
if is_mom_under_bot then -(if is_weighted then 5 else 1) else 0;
#//if is_price_over_top
def total2 = if is_price_over_top then total1 + (if is_weighted then 5 else 1) else
if is_price_under_bot then total1 - (if is_weighted then 5 else 1) else total1;
#// cloud is green or red
def total3 = if leadLine1 > leadLine2 then total2 + (if is_weighted then 4 else 1)
else total2 - (if is_weighted then 4 else 1);
def total4 = if conversionLine > baseLine then total3 + (if is_weighted then 3 else 1)
else total3 - (if is_weighted then 3 else 1);
def total5 = if close > conversionLine then total4 + 1 else total4 - 1;
def total6 = if close > baseLine then total5 + (if is_weighted then 2 else 1)
else total5 - (if is_weighted then 2 else 1);
def w_sum = if is_weighted then 20 else 6;
def trend = if is_mom_over_top and is_price_over_top then 1 else
if is_mom_under_bot and is_price_under_bot then -1 else 0;
def total = total6 * 100 / w_sum;
def col = if isNaN(total) then 0 else
if total > 0 then if total < 25 then 128 else if total < 50 then 190 else 255 else
if total > -25 then 128 else if total > -50 then 190 else 255;
def trnLine = trend * 100;
plot trendLine = trnLine;
plot momHist = total;
trendLine.SetLineWeight(2);
trendLine.SetDefaultColor(Color.WHITE);
momHist.AssignValueColor(if total > 0 then CreateColor(0, col, 0) else CreateColor(col,0, 0));
momHist.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
plot sigUp = if trend < 0 and trend!=trend[1] and total == -100 then -110 else na;
plot sigDn = if trend > 0 and trend!=trend[1] and total == 100 then 110 else na;
sigUp.SetPaintingStrategy(PaintingStrategy.SQUARES);
sigDn.SetPaintingStrategy(PaintingStrategy.SQUARES);
sigUp.SetDefaultColor(Color.CYAN);
sigDn.SetDefaultColor(Color.MAGENTA);
AssignPriceColor(if !colorBars then Color.CURRENT else
if total > 0 then CreateColor(10, col, 10) else CreateColor(col,10, 10));
#-- END of CODE