Repaints Display MTF Ichimoku Clouds on the Upper Chart For ThinkOrSwim

Repaints

Investingtogive

Member
VIP
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:
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:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

@APOT7
Find these lines of code in the script:
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"));

Change them to look like this:
plot Senkou_Span_A_10M = (tk_10M + kj_10M) / 2;
plot 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"));
 
Is there a lower indicator that shows a series of dots (red=blow, green=above, grey=inside) for the cloud over multiple time frames?

If for example there were 3 time frames of interest: 15 min, 1 hr, 1 Day; then there would be 3 seperate, horizontal lines with varying colored dots (based on price location relative to cloud) for each time frame.

Trying not to re-invent something that has already been created.

Many thanks for your assistance.
 
Last edited by a moderator:
Ask and you shall receive.... Here is an indicator that plots 4 time frames on the bottom.

declare lower;

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;

script LookForward
{
input series = close;
input period = 26;


def lk = fold i = 0 to period with h=0 do if h == 0 and GetValue(series, -i) == yes then i else h;

plot lookforward = lk;
}

script CalculateHighest
{
input new_bar = yes;
input baseperiod = 1;
input bartocheck = 9;
input price = 0;
input barnumber = 10;
input length = 10;



def _highest = if new_bar then fold i1 = 0 to bartocheck with h=0 do if GetValue(barnumber, i1) >= barnumber - length + 1 then Max(h, GetValue(price, i1)) else h else _highest[1];

plot highest = _highest;
}

script CalculateLowest
{
input new_bar = yes;
input baseperiod = 1;
input bartocheck = 9;
input price = 0;
input barnumber = 10;
input length = 10;


def _lowest = if new_bar then fold i2 = 0 to bartocheck with l=99999999 do if GetValue(barnumber, i2) >= barnumber - length + 1 and GetValue(price, i2) > 0 then Min(l, GetValue(price, i2)) else l else _lowest[1];

plot lowest = _lowest;
}

script CalculateHighest2
{
input new_bar = yes;
input baseperiod = 1;
input bartocheck = 9;
input price = 0;
input barnumber = 10;
input frombar = 0;
input tobar = 10;



def _highest = if new_bar then fold i1 = 0 to bartocheck with h=0 do if GetValue(barnumber, i1) <= barnumber - frombar and GetValue(barnumber, i1) >= barnumber - tobar then Max(h, GetValue(price, i1)) else h else _highest[1];

plot highest = _highest;
}

script CalculateLowest2
{
input new_bar = yes;
input baseperiod = 1;
input bartocheck = 9;
input price = 0;
input barnumber = 10;
input frombar = 0;
input tobar = 10;


def _lowest = if new_bar then fold i2 = 0 to bartocheck with l=99999999 do if GetValue(barnumber, i2) <= barnumber - frombar and GetValue(barnumber, i2) >= barnumber - tobar and GetValue(price, i2) > 0 then Min(l, GetValue(price, i2)) else l else _lowest[1];

plot lowest = _lowest;
}

script LookBack
{
input new_bar = yes;
input baseperiod = 1;
input bartocheck = 9;
input price = 0;
input barnumber = 10;
input length = 10;



def _value = if new_bar then fold i1 = 0 to bartocheck with h=0 do if GetValue(barnumber, i1) == barnumber - length then GetValue(price, i1) else h else _value[1];

plot value = _value;
}



def barNum = CompoundValue(1, barNum[1] + 1, 1);


#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;

plot IchimokuSignal_start = if ( isnaN(close),double.NaN, 4);
IchimokuSignal_start.SetPaintingStrategy(PaintingStrategy.POINTS);
IchimokuSignal_start.AssignValueColor( if (Showstart and close_start > Max(Senkou_Span_A_start, Senkou_Span_B_start)) then Color.GREEN else if (Showstart and close_start < Min(Senkou_Span_A_start, Senkou_Span_B_start)) then Color.RED else Color.Yellow);
IchimokuSignal_start.SetLineWeight(2);
IchimokuSignal_start.SetHiding(Showstart==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;

plot IchimokuSignal_10M = if ( isnaN(close),double.NaN, 3);
IchimokuSignal_10M.SetPaintingStrategy(PaintingStrategy.POINTS);
IchimokuSignal_10M.AssignValueColor( if (Show10Minutes and close_10M > Max(Senkou_Span_A_10M, Senkou_Span_B_10M)) then Color.GREEN else if (Show10Minutes and close_10M < Min(Senkou_Span_A_10M, Senkou_Span_B_10M)) then Color.RED else Color.Yellow);
IchimokuSignal_10M.SetLineWeight(2);
IchimokuSignal_10M.SetHiding(Show10Minutes==no);

#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;

plot IchimokuSignal_1H = if (isnaN(close),double.NaN, 2);
IchimokuSignal_1H.SetPaintingStrategy(PaintingStrategy.POINTS);
IchimokuSignal_1H.AssignValueColor( if (ShowDay and close_1H > Max(Senkou_Span_A_1H, Senkou_Span_B_1H)) then Color.GREEN else if (ShowDay and close_1H < Min(Senkou_Span_A_1H, Senkou_Span_B_1H)) then Color.RED else Color.Yellow);
IchimokuSignal_1H.SetLineWeight(5);
IchimokuSignal_1H.SetHiding(ShowHour==no);

#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;

plot IchimokuSignal_1Day = if (isnaN(close),double.NaN, 1);
IchimokuSignal_1Day.SetPaintingStrategy(PaintingStrategy.POINTS);
IchimokuSignal_1Day.AssignValueColor( if (ShowDay and close_1D > Max(Senkou_Span_A_1D, Senkou_Span_B_1D)) then Color.GREEN else if (ShowDay and close_1D < Min(Senkou_Span_A_1D, Senkou_Span_B_1D)) then Color.RED else Color.Yellow);
IchimokuSignal_1Day.SetLineWeight(5);
IchimokuSignal_1Day.SetHiding(ShowDay==no);
 
Ask and you shall receive.... Here is an indicator that plots 4 time frames on the bottom.

declare lower;

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;

script LookForward
{
input series = close;
input period = 26;


def lk = fold i = 0 to period with h=0 do if h == 0 and GetValue(series, -i) == yes then i else h;

plot lookforward = lk;
}

script CalculateHighest
{
input new_bar = yes;
input baseperiod = 1;
input bartocheck = 9;
input price = 0;
input barnumber = 10;
input length = 10;



def _highest = if new_bar then fold i1 = 0 to bartocheck with h=0 do if GetValue(barnumber, i1) >= barnumber - length + 1 then Max(h, GetValue(price, i1)) else h else _highest[1];

plot highest = _highest;
}

script CalculateLowest
{
input new_bar = yes;
input baseperiod = 1;
input bartocheck = 9;
input price = 0;
input barnumber = 10;
input length = 10;


def _lowest = if new_bar then fold i2 = 0 to bartocheck with l=99999999 do if GetValue(barnumber, i2) >= barnumber - length + 1 and GetValue(price, i2) > 0 then Min(l, GetValue(price, i2)) else l else _lowest[1];

plot lowest = _lowest;
}

script CalculateHighest2
{
input new_bar = yes;
input baseperiod = 1;
input bartocheck = 9;
input price = 0;
input barnumber = 10;
input frombar = 0;
input tobar = 10;



def _highest = if new_bar then fold i1 = 0 to bartocheck with h=0 do if GetValue(barnumber, i1) <= barnumber - frombar and GetValue(barnumber, i1) >= barnumber - tobar then Max(h, GetValue(price, i1)) else h else _highest[1];

plot highest = _highest;
}

script CalculateLowest2
{
input new_bar = yes;
input baseperiod = 1;
input bartocheck = 9;
input price = 0;
input barnumber = 10;
input frombar = 0;
input tobar = 10;


def _lowest = if new_bar then fold i2 = 0 to bartocheck with l=99999999 do if GetValue(barnumber, i2) <= barnumber - frombar and GetValue(barnumber, i2) >= barnumber - tobar and GetValue(price, i2) > 0 then Min(l, GetValue(price, i2)) else l else _lowest[1];

plot lowest = _lowest;
}

script LookBack
{
input new_bar = yes;
input baseperiod = 1;
input bartocheck = 9;
input price = 0;
input barnumber = 10;
input length = 10;



def _value = if new_bar then fold i1 = 0 to bartocheck with h=0 do if GetValue(barnumber, i1) == barnumber - length then GetValue(price, i1) else h else _value[1];

plot value = _value;
}



def barNum = CompoundValue(1, barNum[1] + 1, 1);


#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;

plot IchimokuSignal_start = if ( isnaN(close),double.NaN, 4);
IchimokuSignal_start.SetPaintingStrategy(PaintingStrategy.POINTS);
IchimokuSignal_start.AssignValueColor( if (Showstart and close_start > Max(Senkou_Span_A_start, Senkou_Span_B_start)) then Color.GREEN else if (Showstart and close_start < Min(Senkou_Span_A_start, Senkou_Span_B_start)) then Color.RED else Color.Yellow);
IchimokuSignal_start.SetLineWeight(2);
IchimokuSignal_start.SetHiding(Showstart==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;

plot IchimokuSignal_10M = if ( isnaN(close),double.NaN, 3);
IchimokuSignal_10M.SetPaintingStrategy(PaintingStrategy.POINTS);
IchimokuSignal_10M.AssignValueColor( if (Show10Minutes and close_10M > Max(Senkou_Span_A_10M, Senkou_Span_B_10M)) then Color.GREEN else if (Show10Minutes and close_10M < Min(Senkou_Span_A_10M, Senkou_Span_B_10M)) then Color.RED else Color.Yellow);
IchimokuSignal_10M.SetLineWeight(2);
IchimokuSignal_10M.SetHiding(Show10Minutes==no);

#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;

plot IchimokuSignal_1H = if (isnaN(close),double.NaN, 2);
IchimokuSignal_1H.SetPaintingStrategy(PaintingStrategy.POINTS);
IchimokuSignal_1H.AssignValueColor( if (ShowDay and close_1H > Max(Senkou_Span_A_1H, Senkou_Span_B_1H)) then Color.GREEN else if (ShowDay and close_1H < Min(Senkou_Span_A_1H, Senkou_Span_B_1H)) then Color.RED else Color.Yellow);
IchimokuSignal_1H.SetLineWeight(5);
IchimokuSignal_1H.SetHiding(ShowHour==no);

#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;

plot IchimokuSignal_1Day = if (isnaN(close),double.NaN, 1);
IchimokuSignal_1Day.SetPaintingStrategy(PaintingStrategy.POINTS);
IchimokuSignal_1Day.AssignValueColor( if (ShowDay and close_1D > Max(Senkou_Span_A_1D, Senkou_Span_B_1D)) then Color.GREEN else if (ShowDay and close_1D < Min(Senkou_Span_A_1D, Senkou_Span_B_1D)) then Color.RED else Color.Yellow);
IchimokuSignal_1Day.SetLineWeight(5);
IchimokuSignal_1Day.SetHiding(ShowDay==no);
Thank you very much! This is very good!


Question: What coding needs to be added or modificaitons such that I can view all indicator's plots across any chosen chart timeframe.

For example, let's say I have selected the 1 hr chart time frame. I would like to see the indicator "Dots" for all of the selected timeframes (5 min, 10 min, 1 hr, 1 day). As it stands right now, the indicator only plots when the selected timeframe for the chart is less than the smallest chosen timeframe in the indicator. I think this is related to the AggregationPeriod function, but not adept enough at the coding to solve this yet.
 
# MTF Ichimoku Clouds - Upper Chart
# Investing to Give.

input tenkanPeriod = 9;
input kijunPeriod = 26;
#
input ShowCloud = yes;

#AP
input AP = AggregationPeriod.TEN_MIN;

def high = high(period = AP);
def low = low(period = AP);

def highest_tenkan = Highest(high, tenkanPeriod );
def lowest_tenkan = Lowest(low, tenkanPeriod );
def highest_kijun = Highest(high, kijunPeriod );
def lowest_kijun = Lowest(low, kijunPeriod );

def Tenkan_Sen = (highest_tenkan + lowest_tenkan) / 2;
def Kijun_Sen = (highest_kijun + lowest_kijun) / 2;

def tk = Tenkan_Sen[kijunPeriod];
def kj = Kijun_Sen[kijunPeriod];

def h2 = Highest(high[kijunPeriod], 2 * kijunPeriod);
def l2 = Lowest(low[kijunPeriod], 2 * kijunPeriod);

def Senkou_Span_A = (tk + kj) / 2;
def Senkou_Span_B = (h2 + l2) / 2;

DefineGlobalColor("Bullish", Color.YELLOW);
DefineGlobalColor("Bearish", Color.RED);
AddCloud(if ShowCloud then Senkou_Span_A else Double.NaN, Senkou_Span_B , GlobalColor("Bullish"), GlobalColor("Bearish"));

# End
 
Last edited:
I was messing around and wanted to do a single entry of each time frame because I didn't wish to have 4 instances in one but perhaps only three or two even. So I modified it to be MTF single chart. One can add rename for each time frame. I was also thinking of a chart label and alerts but didn't get that far yet. Just wish to share a concept thanks >> Investingtogive.
 
Last edited:
I have added Bubble options and plotting of Senkou spans. It really is handy when the day cloud is covering everything.
Added an offset to move bubble to right and away from current price a little. Label is nice when managing multiple clouds
and just wish to get a quick glance you don't even need the cloud visible for the label to work. Nice if cleaning up the chart.

I had concatination in for the label timeframes but took it out I think it slows things down a bit. I may revisit this and do like investingtogive with
one large config and add alerts bubbles and labels hmmm....

plot Span_A = Senkou_Span_A;
plot Span_B = Senkou_Span_B;
Span_A.SetDefaultColor(GetColor(3));
Span_B.SetDefaultColor(GetColor(4));


input ShowLabel = no;
AddLabel(ShowLabel, "10m Cloud", if close > Span_A and Span_B then color.green else if close < Span_A and Span_B then color.red else color.gray) ;

input ShowBubble = yes;
input displaceBubbles = 3;
def LastBar = !IsNaN(open) and IsNaN(open[-1]);
addchartbubble(ShowBubble and LastBar[displaceBubbles], Span_A, "10m_SSA" , Getcolor(3), yes);
addchartbubble(ShowBubble and LastBar[displaceBubbles], Span_B, "10m_SSB" , Getcolor(4), yes);
 
Last edited:
Thank you very much! This is very good!


Question: What coding needs to be added or modificaitons such that I can view all indicator's plots across any chosen chart timeframe.

For example, let's say I have selected the 1 hr chart time frame. I would like to see the indicator "Dots" for all of the selected timeframes (5 min, 10 min, 1 hr, 1 day). As it stands right now, the indicator only plots when the selected timeframe for the chart is less than the smallest chosen timeframe in the indicator. I think this is related to the AggregationPeriod function, but not adept enough at the coding to solve this yet.
Here is what I have observed. If you are viewing a 1hr chart then the 5m,10m will not display for lower time frames. If you have included the MTF for the 1 day it will show as long as your chart is included for the day range. If you have for the Wk MTF it will not show unless you include the range of a week. The good thing is with MTF indicators you can switch to a lower time frame like 3m then add for the higher MTF indicators.
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
391 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top