Ichimoku Scan Issues?


Category:
0
0

Hi Pete,

Please check my Ichimoku scan code below. Is the logic correct? Not sure why it gives me all those errors:

def ichiCloudCrossAbove = high[1] < “Span A” and high[1] < “Span B” and close > “Span A” and close > “Span B”;
def ichiCloudCrossBelow = high[1] > “Span A” and high[1] > “Span B” and close < “Span A” and close < “Span B”;

#plot scan = IchiCloudCrossAbove;
plot scan = IchiCloudCrossBelow;

Incompatible parameter: “Span A” at 1:5, Expected double
Incompatible parameter: “Span B” at 1:5
Incompatible parameter: “Span A” at 2:5
Incompatible parameter: “Span B” at 2:5

Please advise. Thanks!

Marked as spam
Posted by (Questions: 23, Answers: 57)
Asked on September 2, 2017 9:27 am
195 views
0

Without the rest of the code it is impossible to tell. That said, if this the entire code, that is your problem.

( at September 2, 2017 9:31 am)
0

Here’s the full code (those errors are gone). However, now the scan is not returned any results (it should though). Please check code and conditions below:
input tenkan_period = 9;
input kijun_period = 26;

def Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
def Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;

def “Span A” = (Tenkan[kijun_period] + Kijun[kijun_period]) / 2;
def “Span B” = (Highest(high[kijun_period], 2 * kijun_period) + Lowest(low[kijun_period], 2 * kijun_period)) / 2;

def ichiCloudCrossAbove = high[1] < "Span A" and high[1] < "Span B" and close > “Span A” and close > “Span B”;
def ichiCloudCrossBelow = high[1] > “Span A” and high[1] > “Span B” and close < "Span A" and close < "Span B"; plot scan = IchiCloudCrossAbove; #plot scan = IchiCloudCrossBelow; On the scan itself, I add this Custom Study filter (above SMA 20 and SMA pointing up for long) SimpleMovingAvg("length"=20) is less than or equal to close For short - below SMA 20 and SMA pointing down SimpleMovingAvg("length"=20) is greater than or equal to close

( at September 2, 2017 10:56 am)
0

Ok, so the errors are gone, good. The lack of results may be due to the rarity of the signal you have defined.

For longs: The high of the previous candle must be completely below the cloud. The close of the current candle must be completely above the cloud. Most of the time, the thickness of the cloud exceeds the ATR between two candles. Occasionally the cloud narrows to a razor thin line. But I think you really don’t want those signals because this tends to occur during consolidations.

And you have a problem with the ichiCloudCrossBelow. You are high of the previous candle where you should be using the low of the previous candle. But even then you will still have the same problem with rarity.

Have you examined the code provided with this video: https://www.hahn-tech.com/thinkorswim-scan-ichimoku/ ?
It includes two types of signals, one of which is a cloud breakout. This may be what you are trying to achieve here?

( at September 2, 2017 1:19 pm)
0

That video helped. Thanks!

( at September 5, 2017 9:14 pm)