Display MTF Ichimoku Clouds on the Upper Chart For ThinkOrSwim
I found it very useful to display MTF (Multi Time Frame) Ichimoku clouds in the Upper Chart. It shows reliable Support and Resistance levels. It can get a little busy when Price is in the middle of all of the clouds, but powerful when price breaks above or below all of the clouds. You can select the 4 different time frames from settings.
Here is the code:
I found it very useful to display MTF (Multi Time Frame) Ichimoku clouds in the Upper Chart. It shows reliable Support and Resistance levels. It can get a little busy when Price is in the middle of all of the clouds, but powerful when price breaks above or below all of the clouds. You can select the 4 different time frames from settings.
Here is the code:
Ruby:
# MTF Ichimoku Clouds - Upper Chart
# Investing to Give.
input Start = AggregationPeriod.TEN_MIN;
input Short = AggregationPeriod.FIFTEEN_MIN;
input Medium = AggregationPeriod.THIRTY_MIN;
input Long = AggregationPeriod.HOUR;
input tenkanPeriod = 9;
input kijunPeriod = 26;
input ShowStart = yes;
input Show10Minutes = yes;
input ShowHour = yes;
input ShowDay = yes;
#Start
def high_Start = high(period = Start);
def low_Start = low(period = Start);
def close_Start = close(period = Start);
def highest_Start_tenkan = Highest(high_Start, tenkanPeriod );
def lowest_Start_tenkan = Lowest(low_Start, tenkanPeriod );
def highest_Start_kijun = Highest(high_Start, kijunPeriod );
def lowest_Start_kijun = Lowest(low_Start, kijunPeriod );
def Tenkan_Sen_Start = (highest_Start_tenkan + lowest_Start_tenkan) / 2;
def Kijun_Sen_Start = (highest_Start_kijun + lowest_Start_kijun) / 2;
def tk_Start = Tenkan_Sen_Start[kijunPeriod];
def kj_Start = Kijun_Sen_Start[kijunPeriod];
def h2_Start = Highest(high_Start[kijunPeriod], 2 * kijunPeriod);
def l2_Start = Lowest(low_Start[kijunPeriod], 2 * kijunPeriod);
def Senkou_Span_A_Start = (tk_Start + kj_Start) / 2;
def Senkou_Span_B_Start = (h2_Start + l2_Start) / 2;
DefineGlobalColor("Bullish", Color.YELLOW);
DefineGlobalColor("Bearish", Color.RED);
AddCloud(Senkou_Span_A_Start, Senkou_Span_B_Start, GlobalColor("Bullish"), GlobalColor("Bearish"));
# Senkou_Span_A_Start.SetHiding(ShowDay==no);
#10M
def high_10M = high(period = Short);
def low_10M = low(period = Short);
def close_10M = close(period = Short);
def highest_10M_tenkan = Highest(high_10M, tenkanPeriod );
def lowest_10M_tenkan = Lowest(low_10M, tenkanPeriod );
def highest_10M_kijun = Highest(high_10M, kijunPeriod );
def lowest_10M_kijun = Lowest(low_10M, kijunPeriod );
def Tenkan_Sen_10M = (highest_10M_tenkan + lowest_10M_tenkan) / 2;
def Kijun_Sen_10M = (highest_10M_kijun + lowest_10M_kijun) / 2;
def tk_10M = Tenkan_Sen_10M[kijunPeriod];
def kj_10M = Kijun_Sen_10M[kijunPeriod];
def h2_10M = Highest(high_10M[kijunPeriod], 2 * kijunPeriod);
def l2_10M = Lowest(low_10M[kijunPeriod], 2 * kijunPeriod);
def Senkou_Span_A_10M = (tk_10M + kj_10M) / 2;
def Senkou_Span_B_10M = (h2_10M + l2_10M) / 2;
DefineGlobalColor("Bullish", Color.YELLOW);
DefineGlobalColor("Bearish", Color.RED);
AddCloud(Senkou_Span_A_10M, Senkou_Span_B_10M, GlobalColor("Bullish"), GlobalColor("Bearish"));
#1H
def high_1H = high(period = Medium);
def low_1H = low(period = Medium);
def close_1H = close(period = Medium);
def highest_1H_tenkan = Highest(high_1H, tenkanPeriod );
def lowest_1H_tenkan = Lowest(low_1H, tenkanPeriod );
def highest_1H_kijun = Highest(high_1H, kijunPeriod );
def lowest_1H_kijun = Lowest(low_1H, kijunPeriod );
def Tenkan_Sen_1H = (highest_1H_tenkan + lowest_1H_tenkan) / 2;
def Kijun_Sen_1H = (highest_1H_kijun + lowest_1H_kijun) / 2;
def tk_1H = Tenkan_Sen_1H[kijunPeriod];
def kj_1H = Kijun_Sen_1H[kijunPeriod];
def h2_1H = Highest(high_1H[kijunPeriod], 2 * kijunPeriod);
def l2_1H = Lowest(low_1H[kijunPeriod], 2 * kijunPeriod);
def Senkou_Span_A_1H = (tk_1H + kj_1H) / 2;
def Senkou_Span_B_1H = (h2_1H + l2_1H) / 2;
DefineGlobalColor("Bullish", Color.YELLOW);
DefineGlobalColor("Bearish", Color.RED);
AddCloud(Senkou_Span_A_1H, Senkou_Span_B_1H, GlobalColor("Bullish"), GlobalColor("Bearish"));
#1D
def high_1D = high(period = Long);
def low_1D = low(period = Long);
def close_1D = close(period = Long);
def highest_1D_tenkan = Highest(high_1D, tenkanPeriod );
def lowest_1D_tenkan = Lowest(low_1D, tenkanPeriod );
def highest_1D_kijun = Highest(high_1D, kijunPeriod );
def lowest_1D_kijun = Lowest(low_1D, kijunPeriod );
def Tenkan_Sen_1D = (highest_1D_tenkan + lowest_1D_tenkan) / 2;
def Kijun_Sen_1D = (highest_1D_kijun + lowest_1D_kijun) / 2;
def tk_1D = Tenkan_Sen_1D[kijunPeriod];
def kj_1D = Kijun_Sen_1D[kijunPeriod];
def h2_1D = Highest(high_1D[kijunPeriod], 2 * kijunPeriod);
def l2_1D = Lowest(low_1D[kijunPeriod], 2 * kijunPeriod);
def Senkou_Span_A_1D = (tk_1D + kj_1D) / 2;
def Senkou_Span_B_1D = (h2_1D + l2_1D) / 2;
DefineGlobalColor("Bullish", Color.YELLOW);
DefineGlobalColor("Bearish", Color.RED);
AddCloud(Senkou_Span_A_1D, Senkou_Span_B_1D, GlobalColor("Bullish"), GlobalColor("Bearish"));
# End
Last edited by a moderator: