# Modified Ichimoku issues

#### RedToGreen

##### Active member
So I've been messing around with the ichimoku, I know there's some people who instead of a 9-26, will use a 18-52.
On the chart I have a cloud, refrencing the Tenkan 4 & Kijun 52.
You can see the tenkan 4 is greater than the Kijun 52, via the green cloud and also the label.

When I run a scan for a short;

def short = Tenkan4 < kijun52;
plot s = short;
...
Tsla comes up on the scan as fitting that criteria but my chart says differently.

If anyone can point me in the right direction as to what if anything I'm doing incorectly, I'd appreciate it
Thank you

Code:
``````#=============================================

input price = close;
input showT4 = no;
input showk13 = no;
input showT18 = no;
input showK52 = no;

input T4 = 4.5;
input K13 = 13;
input T18 = 18;
input K52 = 52;

# ===================================================================================
# ======================== TENKAN/KIJUN
def Tenkan4 = (Highest(high, T4) + Lowest(low, T4)) / 2  ;
def Kijun13 = (Highest(high, K13) + Lowest(low, K13)) / 2;
def AA = (Tenkan4[K13] + Kijun13[K13]) / 2;
def BA = (Highest(high[K13], 2 * K13) + Lowest(low[K13], 2 * K13)) / 2;

def Tenkan18 = (Highest(high, T18) + Lowest(low, T18)) / 2;
def Kijun52 = (Highest(high, K52) + Lowest(low, K52)) / 2;
def A2 = (Tenkan18[K52] + Kijun52[K52]) / 2;
def B2 = (Highest(high[K52], 2 * K52) + Lowest(low[K52], 2 * K52)) / 2;

# ============================================================================
# ================== TK PLOTS =========================================
plot T = IF SHOWT4 THEN tenkan4 ELSE DOUBle.NaN;
plot k = IF SHOWk13 THEN kijun13 ELSE DOUBle.NaN;
T.SetDefaultColor(CreateColor(75,235,175));
T.SetLineWeight(1);
T.SetStyle(Curve.FIRM);
K.SetDefaultColor(CreateColor(219,75,68));
K.SetLineWeight(1);
K.SetStyle(Curve.FIRM);

plot T2 = IF SHOWt18 THEN tenkan18 ELSE DOUBle.NaN;
plot k2 = IF SHOWk52 THEN kijun52 ELSE DOUBle.NaN;
T2.SetDefaultColor(CreateColor(99,211,146));
T2.SetLineWeight(2);
T2.SetStyle(Curve.FIRM);
K2.SetDefaultColor(CreateColor(158,19,19));
K2.SetLineWeight(2);
K2.SetStyle(Curve.FIRM);

AddCloud( tenkan4, kijun52,     CreateColor(57,186,100),      CreateColor(221,65,65));  #*

# =================== conditions ==============================
# ============= Current cloud Status ========================

def tkl4 = tenkan4 > kijun52;
def tks4 = tenkan4 < kijun52;

plot S = tks4;

AddLabel(yes, if tkl4 then "-T4 > K52-" else if TKS4 then "-T4 < K52-" else "", if TKL4 then CreateColor(63, 187, 93) else if  TKS4 then CreateColor(191, 42, 42) else Color.DARK_GRAY);``````

Solution
So I've been messing around with the ichimoku, I know there's some people who instead of a 9-26, will use a 18-52.
On the chart I have a cloud, refrencing the Tenkan 4 & Kijun 52.
You can see the tenkan 4 is greater than the Kijun 52, via the green cloud and also the label.

When I run a scan for a short;

def short = Tenkan4 < kijun52;
plot s = short;
...
Tsla comes up on the scan as fitting that criteria but my chart says differently.

If anyone can point me in the right direction as to what if anything I'm doing incorectly, I'd appreciate it
Thank you

Code:
``````#=============================================

input price = close;
input showT4 = no;
input showk13 = no;
input showT18 = no;
input showK52...``````
So I've been messing around with the ichimoku, I know there's some people who instead of a 9-26, will use a 18-52.
On the chart I have a cloud, refrencing the Tenkan 4 & Kijun 52.
You can see the tenkan 4 is greater than the Kijun 52, via the green cloud and also the label.

When I run a scan for a short;

def short = Tenkan4 < kijun52;
plot s = short;
...
Tsla comes up on the scan as fitting that criteria but my chart says differently.

If anyone can point me in the right direction as to what if anything I'm doing incorectly, I'd appreciate it
Thank you

Code:
``````#=============================================

input price = close;
input showT4 = no;
input showk13 = no;
input showT18 = no;
input showK52 = no;

input T4 = 4.5;
input K13 = 13;
input T18 = 18;
input K52 = 52;

# ===================================================================================
# ======================== TENKAN/KIJUN
def Tenkan4 = (Highest(high, T4) + Lowest(low, T4)) / 2  ;
def Kijun13 = (Highest(high, K13) + Lowest(low, K13)) / 2;
def AA = (Tenkan4[K13] + Kijun13[K13]) / 2;
def BA = (Highest(high[K13], 2 * K13) + Lowest(low[K13], 2 * K13)) / 2;

def Tenkan18 = (Highest(high, T18) + Lowest(low, T18)) / 2;
def Kijun52 = (Highest(high, K52) + Lowest(low, K52)) / 2;
def A2 = (Tenkan18[K52] + Kijun52[K52]) / 2;
def B2 = (Highest(high[K52], 2 * K52) + Lowest(low[K52], 2 * K52)) / 2;

# ============================================================================
# ================== TK PLOTS =========================================
plot T = IF SHOWT4 THEN tenkan4 ELSE DOUBle.NaN;
plot k = IF SHOWk13 THEN kijun13 ELSE DOUBle.NaN;
T.SetDefaultColor(CreateColor(75,235,175));
T.SetLineWeight(1);
T.SetStyle(Curve.FIRM);
K.SetDefaultColor(CreateColor(219,75,68));
K.SetLineWeight(1);
K.SetStyle(Curve.FIRM);

plot T2 = IF SHOWt18 THEN tenkan18 ELSE DOUBle.NaN;
plot k2 = IF SHOWk52 THEN kijun52 ELSE DOUBle.NaN;
T2.SetDefaultColor(CreateColor(99,211,146));
T2.SetLineWeight(2);
T2.SetStyle(Curve.FIRM);
K2.SetDefaultColor(CreateColor(158,19,19));
K2.SetLineWeight(2);
K2.SetStyle(Curve.FIRM);

AddCloud( tenkan4, kijun52,     CreateColor(57,186,100),      CreateColor(221,65,65));  #*

# =================== conditions ==============================
# ============= Current cloud Status ========================

def tkl4 = tenkan4 > kijun52;
def tks4 = tenkan4 < kijun52;

plot S = tks4;

AddLabel(yes, if tkl4 then "-T4 > K52-" else if TKS4 then "-T4 < K52-" else "", if TKL4 then CreateColor(63, 187, 93) else if  TKS4 then CreateColor(191, 42, 42) else Color.DARK_GRAY);``````

Works fine on a chart but not scanner. Probably has something to do with the 3-1 split is causing scan problems with TSLA on a Daily. The intraday scan on TSLA seems okay.

Works fine on a chart but not scanner. Probably has something to do with the 3-1 split is causing scan problems with TSLA on a Daily. The intraday scan on TSLA seems okay.
I was thinking the same about the split but wasn't sure. Guess it's just an anomaly or I found a scan that predicts the future

Once again, Thank you

87k+ Posts
191 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?