# RepaintsMTF Ichimoku and Donchian Indicators

Repaints

#### tangodino

##### New member
Code:
``````#MTF Ichi Cloud
#Code by mangomick

input agg = AggregationPeriod.DAY;
input h = FundamentalType.HIGH;
input l = FundamentalType.LOW;
input tPeriod = 9;

def htenkan = highest(Fundamental(h, period = agg), tPeriod);
def ltenkan = lowest(Fundamental(l, period = agg), tPeriod);
plot tenkan = (htenkan+ltenkan)/2;

input kPeriod=26;
def hkijun = highest(Fundamental(h, period = agg), kPeriod);
def lkijun = lowest(Fundamental(l, period = agg), kPeriod);
plot kijun = (hkijun+lkijun)/2;

def Atenkan=(htenkan[26]+ltenkan[26])/2;
def Akijun=(hkijun[26]+lkijun[26])/2;
plot SpanA=(Atenkan+Akijun)/2;

input bPeriod=52;
def bhigh=highest(Fundamental(h,period=agg),bPeriod)[26];
def blow=lowest(Fundamental(l,period=agg),bPeriod)[26];
plot SpanB=(bhigh+blow)/2;

## End

## Donchian Channels
# Code by john2000

input displace = 0;
input length = 20;

plot LowerBand = Lowest(low[-displace + 0], length);
LowerBand.SetDefaultColor(GetColor(8));

plot UpperBand = Highest(high[-displace + 0], length);
UpperBand.SetDefaultColor(GetColor(8));

plot MidBand = ((UpperBand+LowerBand)/2) ;
MidBand.SetDefaultColor(GetColor(1));

## End``````

It took a few weeks of future testing but I found out the 5m Ichi Base line set at 20 equals the 5m Donchian Middle Band set at 20. Using two Donchian Channels at 10 and 20 plus a MTF at 15m Ichi cloud I've found very strong indicators if one considers the 10, 20, Tenkan and Kijun as a sort of Ribbon Mov Avg. I'm inclined to turn the clouds grey as they might throw some false signals, I want to consider them just "magnet zones of turbulence". Note RSI oversold / overbought areas as well as the 50 level crossing. Note MACD crossing on considerate level away from zero line. Note setting at 10-20-(40) across the board (ichi 9-26 and EMA 200 are not being shown).

Note Donchian upper and lower levels are NOT being shown. The Purple line is the Donchian 20 Mid channel, Blue Donchian 10 mid channel, Green 15m Tenkan, Red 15m Kijun. Consider entry at Donchian 10 Donchian 20 cross, price action donchian 10 breakout, cloud breakout, MACD cross away from zero line opposite momentum and confirm with RSI 50 cross over. Consider Stop Loss / Take Profit at swing low / high, ATR Multiple, MACD Crossing, Price Action Donchian 10 Cross or Cloud level crossing. Always at 2% and 1/1.5 RR or manually trail. Draw support and resistance at 1 hour and consider their influence on the trend. Note Chikou is not turned on either. Above code does not include Chikou for reference so I'm stuck with the 9-26, 10-20.

Any feedback would be awesome.

I have been following the Ichimoku study for some time now, and have decided to create an MTF study to aid in picking what I believe to be decent plays.
Code:
``````input turning_period = 9;
input standard_period = 26;

#Ichimoku for displayed period
plot Turning = (Highest(high, turning_period) + Lowest(low, turning_period)) / 2;
plot Standard = (Highest(high, standard_period) + Lowest(low, standard_period)) / 2;
def "Span A" = (Turning[standard_period] + Standard[standard_period]) / 2;
def "Span B" = (Highest(high[standard_period], 2 * standard_period) + Lowest(low[standard_period], 2 * standard_period)) / 2;
plot Lagging = close[-standard_period];
DefineGlobalColor("Turning", Color.GREEN);
DefineGlobalColor("Standard", Color.RED);
DefineGlobalColor("Lagging", CreateColor(102, 0, 102));
Turning.SetDefaultColor(GlobalColor("Turning"));
Standard.SetDefaultColor(GlobalColor("Standard"));
Lagging.SetLineWeight(2);
Lagging.SetDefaultColor(GlobalColor("Lagging"));
Lagging.SetLineWeight(3);
DefineGlobalColor("Bullish", Color.GREEN);
DefineGlobalColor("Bearish", Color.RED);
AddCloud("Span A", "Span B", globalColor("Bullish"), globalColor("Bearish"));

# WEEK LABELS
def IC_week_close;
def IC_week_Turning;
def IC_week_Standard;
def IC_week_Lagging;
def IC_week_SpanA;
def IC_week_SpanB;
def IC_week_AboveCloud;
def IC_week_InCloud;
def IC_week_BelowCloud;
def IC_week_AggregationPeriod;

if GetAggregationPeriod() <= AggregationPeriod.WEEK {
IC_week_AggregationPeriod = AggregationPeriod.WEEK;
IC_week_close = close(period = IC_week_AggregationPeriod);
IC_week_Turning = (Highest(high(period = IC_week_AggregationPeriod), turning_period) + Lowest(low(period = IC_week_AggregationPeriod), turning_period)) / 2;
IC_week_Standard = (Highest(high(period = IC_week_AggregationPeriod), standard_period) + Lowest(low(period = IC_week_AggregationPeriod), standard_period)) / 2;
IC_week_SpanA = (IC_week_Turning[standard_period] + IC_week_Standard[standard_period]) / 2;
IC_week_SpanB = (Highest(high[standard_period], 2 * standard_period) + Lowest(low[standard_period], 2 * standard_period)) / 2;
IC_week_Lagging = close[-standard_period];

IC_week_InCloud = if ((IC_week_SpanA > IC_week_close) and (IC_week_close > IC_week_SpanB)) or ((IC_week_SpanB > IC_week_close) and (IC_week_close > IC_week_SpanA)) then 1 else Double.NaN;
IC_week_AboveCloud = if IC_week_close > IC_week_SpanA and IC_week_close > IC_week_SpanB then 1 else Double.NaN;
IC_week_BelowCloud = if IC_week_close < IC_week_SpanA and IC_week_close < IC_week_SpanB then 1 else Double.NaN;

} else {
IC_week_close = 0;
IC_week_SpanA = 0;
IC_week_SpanB = 0;
IC_week_Turning = 0;
IC_week_Standard = 0;
IC_week_Lagging = 0;
IC_week_InCloud = Double.NaN;
IC_week_AboveCloud = Double.NaN;
IC_week_BelowCloud = Double.NaN;
IC_week_AggregationPeriod = Double.NaN;
}

# DAY LABELS
def IC_day_close;
def IC_day_Turning;
def IC_day_Standard;
def IC_day_Lagging;
def IC_day_SpanA;
def IC_day_SpanB;
def IC_day_AboveCloud;
def IC_day_InCloud;
def IC_day_BelowCloud;
def IC_day_AggregationPeriod;
if GetAggregationPeriod() <= AggregationPeriod.DAY {
IC_day_AggregationPeriod = AggregationPeriod.DAY;
IC_day_close = close(period = IC_day_AggregationPeriod);
IC_day_Turning = (Highest(high(period = IC_day_AggregationPeriod), turning_period) + Lowest(low(period = IC_day_AggregationPeriod), turning_period)) / 2;
IC_day_Standard = (Highest(high(period = IC_day_AggregationPeriod), standard_period) + Lowest(low(period = IC_day_AggregationPeriod), standard_period)) / 2;
IC_day_SpanA = (IC_day_Turning[standard_period] + IC_day_Standard[standard_period]) / 2;
IC_day_SpanB = (Highest(high[standard_period], 2 * standard_period) + Lowest(low[standard_period], 2 * standard_period)) / 2;
IC_day_Lagging = close[-standard_period];

IC_day_InCloud = if ((IC_day_SpanA > IC_day_close) and (IC_day_close > IC_day_SpanB)) or ((IC_day_SpanB > IC_day_close) and (IC_day_close > IC_day_SpanA)) then 1 else Double.NaN;
IC_day_AboveCloud = if IC_day_close > IC_day_SpanA and IC_day_close > IC_day_SpanB then 1 else Double.NaN;
IC_day_BelowCloud = if IC_day_close < IC_day_SpanA and IC_day_close < IC_day_SpanB then 1 else Double.NaN;

} else {
IC_day_close = 0;
IC_day_SpanA = 0;
IC_day_SpanB = 0;
IC_day_Turning = 0;
IC_day_Standard = 0;
IC_day_Lagging = 0;
IC_day_InCloud = Double.NaN;
IC_day_AboveCloud = Double.NaN;
IC_day_BelowCloud = Double.NaN;
IC_day_AggregationPeriod = Double.NaN;
}

# HOUR LABELS
def IC_hour_close;
def IC_hour_Turning;
def IC_hour_Standard;
def IC_hour_Lagging;
def IC_hour_SpanA;
def IC_hour_SpanB;
def IC_hour_AboveCloud;
def IC_hour_InCloud;
def IC_hour_BelowCloud;
def IC_hour_AggregationPeriod;
if GetAggregationPeriod() <= AggregationPeriod.HOUR {
IC_hour_AggregationPeriod = AggregationPeriod.HOUR;
IC_hour_close = close(period = IC_hour_AggregationPeriod);
IC_hour_Turning = (Highest(high(period = IC_hour_AggregationPeriod), turning_period) + Lowest(low(period = IC_hour_AggregationPeriod), turning_period)) / 2;
IC_hour_Standard = (Highest(high(period = IC_hour_AggregationPeriod), standard_period) + Lowest(low(period = IC_hour_AggregationPeriod), standard_period)) / 2;
IC_hour_SpanA = (IC_hour_Standard[standard_period] + IC_hour_Standard[standard_period]) / 2;
IC_hour_SpanB = (Highest(high[standard_period], 2 * standard_period) + Lowest(low[standard_period], 2 * standard_period)) / 2;
IC_hour_Lagging = close[-standard_period];

IC_hour_InCloud = if ((IC_hour_SpanA > IC_hour_close) and (IC_hour_close > IC_hour_SpanB)) or ((IC_hour_SpanB > IC_hour_close) and (IC_hour_close > IC_hour_SpanA)) then 1 else Double.NaN;
IC_hour_AboveCloud = if IC_hour_close > IC_hour_SpanA and IC_hour_close > IC_hour_SpanB then 1 else Double.NaN;
IC_hour_BelowCloud = if IC_hour_close < IC_hour_SpanA and IC_hour_close < IC_hour_SpanB then 1 else Double.NaN;

} else {
IC_hour_close = 0;
IC_hour_SpanA = 0;
IC_hour_SpanB = 0;
IC_hour_Turning = 0;
IC_hour_Standard = 0;
IC_hour_Lagging = 0;
IC_hour_InCloud = Double.NaN;
IC_hour_AboveCloud = Double.NaN;
IC_hour_BelowCloud = Double.NaN;
IC_hour_AggregationPeriod = Double.NaN;
}

# TEN_MIN LABELS
def IC_ten_min_close;
def IC_ten_min_Turning;
def IC_ten_min_Standard;
def IC_ten_min_Lagging;
def IC_ten_min_SpanA;
def IC_ten_min_SpanB;
def IC_ten_min_AboveCloud;
def IC_ten_min_InCloud;
def IC_ten_min_BelowCloud;
def IC_ten_min_AggregationPeriod;
if GetAggregationPeriod() <= AggregationPeriod.TEN_MIN {
IC_ten_min_AggregationPeriod = AggregationPeriod.TEN_MIN;
IC_ten_min_close = close(period = IC_ten_min_AggregationPeriod);
IC_ten_min_Turning = (Highest(high(period = IC_ten_min_AggregationPeriod), turning_period) + Lowest(low(period = IC_ten_min_AggregationPeriod), turning_period)) / 2;
IC_ten_min_Standard = (Highest(high(period = IC_ten_min_AggregationPeriod), standard_period) + Lowest(low(period = IC_ten_min_AggregationPeriod), standard_period)) / 2;
IC_ten_min_SpanA = (IC_ten_min_Turning[standard_period] + IC_ten_min_Standard[standard_period]) / 2;
IC_ten_min_SpanB = (Highest(high[standard_period], 2 * standard_period) + Lowest(low[standard_period], 2 * standard_period)) / 2;
IC_ten_min_Lagging = close[-standard_period];

IC_ten_min_InCloud = if ((IC_ten_min_SpanA > IC_ten_min_close) and (IC_ten_min_close > IC_ten_min_SpanB)) or ((IC_ten_min_SpanB > IC_ten_min_close) and (IC_ten_min_close > IC_ten_min_SpanA)) then 1 else Double.NaN;
IC_ten_min_AboveCloud = if IC_ten_min_close > IC_ten_min_SpanA and IC_ten_min_close > IC_ten_min_SpanB then 1 else Double.NaN;
IC_ten_min_BelowCloud = if IC_ten_min_close < IC_ten_min_SpanA and IC_ten_min_close < IC_ten_min_SpanB then 1 else Double.NaN;

} else {
IC_ten_min_close = 0;
IC_ten_min_SpanA = 0;
IC_ten_min_SpanB = 0;
IC_ten_min_Turning = 0;
IC_ten_min_Standard = 0;
IC_ten_min_Lagging = 0;
IC_ten_min_InCloud = Double.NaN;
IC_ten_min_AboveCloud = Double.NaN;
IC_ten_min_BelowCloud = Double.NaN;
IC_ten_min_AggregationPeriod = Double.NaN;
}

Last edited by a moderator:
Can i use this on 5 or 1 min chart?

i am on D chart and W label is in yellow..but when I go to W chart, then W becomes green which is correct.

Can i use this on 5 or 1 min chart?

i am on D chart and W label is in yellow..but when I go to W chart, then W becomes green which is correct.
@royalrock I have not found a way to resolve this issue. What is happening is the Week dots extend off to the right under the cloud and I have not figured out a way to stop this. Also, as there is no price action there since it hasn't happened yet, the script simply outputs a yellow dot. Yes, I could code it to do something different, but when the nuances are understood, I didn't feel it was that big if an issue. But to answer your main question, yes you can use all the way down to the TICK chart if you wanted, but IMO not much value is added as Ichimoku is considered to be more of a longer term indicator. Some would argue that you shouldn't use it on TF less than 1H.

I am trying to make the cloud color to opacity 50 or so... defineglobal color is not working unless I am missing something

could someone help.

87k+ Posts
347 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?